Regularity
From Maze
(Difference between revisions)
(Moved over some additional edited/revised sections) | (→FOR ... TO ... STEP (Sidebar)) | ||
| Line 81: | Line 81: | ||
=== FOR ... TO ... STEP (Sidebar) === | === FOR ... TO ... STEP (Sidebar) === | ||
| − | The FOR loop in BASIC is a bit more general than is shown in the example in the main text. It can be used not only to increment a variable, but also to change its value each time by any amount. This is done using the STEP keyword. To show only the even numbers between 2 and 10: | + | The FOR loop in BASIC is a bit more general than is shown in the example in the main text. It can be used not only to increment a variable, but also to change its value each time by any amount. A different increment is set using the STEP keyword. To show only the even numbers between 2 and 10: |
<nowiki>10 FOR A=2 TO 10 STEP 2 | <nowiki>10 FOR A=2 TO 10 STEP 2 | ||
