3.2.6 for
Description:
The for statement is a loop statement very convenient for making counter-controlled loops.
With a simple trick you can use the same statement to make an infinite loop.
Declaration:
- for int indexVar = num startValue to int endValue step stepValue
for statements
endfor
Notes:
step can be a negative value, with step 0 you get an infinite loop!
Example:
this program produces this output:
1 hello! 2 hello! 3 hello! 4 hello! 5 hello! 6 hello! 7 hello! 8 hello! 9 hello! 10 hello!