Changes

Jump to: navigation, search

Locomotive BASIC

974 bytes added, 21:22, 12 September 2012
/* FOR TO STEP NEXT */
==== <code>FOR TO STEP NEXT</code> ====
: Creating a counting loop (control strucutre) with a starting condition. Inside the counting loop one or more commands will be executed.: The loop consists of of following specifications: : 1. FOR: 2. ''a control variable'': 3. =: 4. ''starting value'': 5. TO: 6. ''target value'': 7. STEP [optional]: 8.''increment / step size'': ''... instructions between'': 9. NEXT: 10. ''control variable'' [optional: You have to use the command STEP if you wish to count backwards. It's good to name the ''control variable'' after NEXT for readability and better program style.: After each loop the computer checks internaly if the ''target value'' has been reached (like an IF ... THEN ... ELSE instruction). If the target value is reached NEXT closes the loop and calculates another step, so the ''control variable'' will be changed last time. : Example:<pre>10 FOR I=1 TO 1020 PRINT I;30 NEXT I40 PRINT IRUN1 2 3 4 5 6 7 8 9 10 11READY</pre>
==== <code>FRAME</code> ====
205
edits