![]() |
| ||||||||||||||||||
![]() |
| ||||||||||||||||||
|
Use a for loop to cycle over a fixed range of numbers.
for i = 1 to 3 Print (i) 1 2 3 for i = 5 to 12 step 2 Print (i) 5 7 9 11 for i = 20.0 to 15.0 step -1.5 Print (i) 20.0 18.5 17.0 15.5 For testing purposes, you can of course also type a loop directly into the console. Just make sure to keep the indentation
(the first loop iteration will execute while you type) and close the loop by typing a command without indentation:
>for i=1 to 3 > Print (i) 1 > Print (i*4) 4 >Print 'Done' 2 8 3 12 Done
| ||||||||||||||||||