This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:for [2016/08/07 21:03] admin |
en:for [2020/04/26 22:26] (current) admin |
||
---|---|---|---|
Line 1: | Line 1: | ||
===== For / Next (Statement) ===== | ===== For / Next (Statement) ===== | ||
==== Format ==== | ==== Format ==== | ||
- | **for** [[variables|variable]] = | + | **for** [[variables|variable]] = |
- | (tab)//statement(s)//\\ | + | (tab)[[programsyntax|statement(s)]]\\ |
**next** [[variables|variable]] | **next** [[variables|variable]] | ||
==== Description ==== | ==== Description ==== | ||
- | The FOR and NEXT commands are used in conjunction to execute a command or group of commands a specified number of times. When the FOR command is first encountered, | + | The FOR and NEXT commands are used in conjunction to execute a command or group of commands a specified number of times. When the FOR command is first encountered, |
- | After each NEXT command, variable is incremented by 1 (the default), or by // | + | After each NEXT command, variable is incremented by 1 (the default), or by [[numericexpressions|step_expression]] |
==== Example ==== | ==== Example ==== | ||
< | < | ||
- | for i = 1 to 10 | + | for i = 1 to 5 |
print i | print i | ||
next i | next i | ||
print "after the for " + i | print "after the for " + i | ||
+ | |||
+ | for k = 5 to 1 step -1 | ||
+ | ? k | ||
+ | next | ||
</ | </ | ||
displays | displays | ||
Line 25: | Line 29: | ||
4 | 4 | ||
5 | 5 | ||
- | 6 | + | after the for 6 |
- | 7 | + | 5 |
- | 8 | + | 4 |
- | 9 | + | 3 |
- | 10 | + | 2 |
- | after the for 11 | + | 1 |
</ | </ | ||
==== See Also ==== | ==== See Also ==== | ||
{{page> | {{page> | ||
+ | |||
+ | ==== History ==== | ||
+ | |2.0.0.0|Variable in Next statement is now optional| |