Loops/For with a specified step: Difference between revisions

Content added Content deleted
m (Undo revision 353770 by Bernie (talk))
m (Fix FutureBasic alpha position)
Line 1,407: Line 1,407:
for a = 1 km to 3 km step 1 meter
for a = 1 km to 3 km step 1 meter
println[a]
println[a]
</syntaxhighlight>

=={{header|GAP}}==
# Use a range [a, b .. c], where the step is b-a (b is the value following a), and c-a must be a multiple of the step.
<syntaxhighlight lang="gap">for i in [1, 3 .. 11] do
Print(i, "\n");
od;

1
3
5
7
9
11
</syntaxhighlight>
</syntaxhighlight>


Line 1,446: Line 1,432:
<syntaxhighlight lang="gml">for(i = 0; i < 10; i += 2)
<syntaxhighlight lang="gml">for(i = 0; i < 10; i += 2)
show_message(string(i))</syntaxhighlight>
show_message(string(i))</syntaxhighlight>

=={{header|GAP}}==
# Use a range [a, b .. c], where the step is b-a (b is the value following a), and c-a must be a multiple of the step.
<syntaxhighlight lang="gap">for i in [1, 3 .. 11] do
Print(i, "\n");
od;

1
3
5
7
9
11
</syntaxhighlight>


=={{header|Go}}==
=={{header|Go}}==