Difference between revisions of "Repeat..until"
From Wiki
(→Description) |
(→Synopsis) |
||
Line 3: | Line 3: | ||
'''Flow Control''' | '''Flow Control''' | ||
=== Synopsis === | === Synopsis === | ||
− | Repeat | + | Repeat {} |
− | until | + | until {expression} |
+ | |||
=== Description === | === Description === | ||
The repeat..until control structure executes the code block between the statements, and then evaluates the expression. If the expression is true, the code is executed again. | The repeat..until control structure executes the code block between the statements, and then evaluates the expression. If the expression is true, the code is executed again. |
Revision as of 01:10, 25 August 2005
Repeat..until
Flow Control
Synopsis
Repeat {} until {expression}
Description
The repeat..until control structure executes the code block between the statements, and then evaluates the expression. If the expression is true, the code is executed again. Unlike while loops, repeat..until loops will always execute the code within the loop at least once.
Example
set %str Hello , #spc , World repeat set %str %str , ! str len %str until #strres >= 30 display ok %str halt
The example above illustrates the difference between a repeat..until loop and a while loop. the exclamation point will always be concatinated to the end of the %str variable, and str len will be executed once before the test for #strRes >= 30 is first evaluated.
See Also
while | for | continue | break |
Main_Page | Documentation | Flow Control |