Anonymous user
Loops/For with a specified step: Difference between revisions
Loops/For with a specified step (view source)
Revision as of 17:55, 10 September 2010
, 13 years agoAdd Bash example
No edit summary |
(Add Bash example) |
||
Line 68:
}
ExitApp</lang>
=={{header|Bash}}==
<lang bash>for ((i=0;i<10;i+=2)); do
echo "$i"
done</lang>
Do the same loop with steps of 2 3 and 4
<lang bash>for step in 2 3 4; do
for ((i=0;i<10;i+=step)); do
echo "step ${step}: $i"
done
done</lang>
=={{header|BASIC}}==
|