Loops/For with a specified step: Difference between revisions
m
Fix FutureBasic alpha position
m (Fix FutureBasic alpha position) |
|||
Line 1,407:
for a = 1 km to 3 km step 1 meter
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>
Line 1,446 ⟶ 1,432:
<syntaxhighlight lang="gml">for(i = 0; i < 10; i += 2)
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}}==
|