Programmer Guide/Command Reference/FOR: Difference between revisions
From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import) |
(→FOR) |
||
Line 17: | Line 17: | ||
;<var>cond</var> | ;<var>cond</var> | ||
:The condition which should be tested at the start of each loop (e.g. $#i < 10). See the [[Programmer Guide/Command Reference/condition|condition]] topic for the condition syntax. | :The condition which should be tested at the start of each loop (e.g. $#i < 10). See the [[Programmer Guide/Command Reference Intro/condition|condition]] topic for the condition syntax. | ||
;<var>step</var> | ;<var>step</var> |
Revision as of 17:23, 22 March 2011
FOR
FOR [ target := init ] TO cond STEP step // commands
END
Excecute the commands in the FOR loop while the condition holds true.
- target
- The incremental counter variable to initialize with the value init (e.g. #i).
- init
- The value with which to initialize the counter variable target (e.g. 0).
- cond
- The condition which should be tested at the start of each loop (e.g. $#i < 10). See the condition topic for the condition syntax.
- step
- The incremental value to add to the counter variable target at the end of each loop. The assignment syntax (e.g. #i := int $#i+1) is allowed.
FOR #i := 0 TO $#i < 10 STEP #i := int $#i+1 BUTIL MSGBOX MSG; #i = $#i END // an example without initialisation FOR TO $#x > $#y STEP #i := int $#i + 1 // do something here ... END