Do: Difference between revisions
No edit summary |
No edit summary |
||
Line 16: | Line 16: | ||
The word DO on the DO statement is optional when WHILE or UNTIL is specified. Business Rules will insert the word DO. CONFIG STYLE INDENT will cause lines between the DO and LOOP statements to be indented. | The word DO on the DO statement is optional when WHILE or UNTIL is specified. Business Rules will insert the word DO. CONFIG STYLE INDENT will cause lines between the DO and LOOP statements to be indented. | ||
===Example=== | |||
This do loop waits for [[Check Box]]es to be selected before the operator pushes a "Done" [[Print Fields Button|Button]]. | |||
00350 do | |||
00360 input fields "22,14,CHECK 8,,10;23,14,CHECK 8,,11;24,14,CHECK 8,,12": Box$(1),Box$(2),Box$(3) | |||
00370 print fields "24,1,N 2": Fkey | |||
00380 loop While Fkey~=99 | |||
<noinclude> | <noinclude> |
Revision as of 19:04, 16 July 2013
The DO/LOOP structure, which can be used to replace GOTO statements for more structured programming. Notably, labels or line numbers are not required to exit the loop. The DO and LOOP statements must always be used in conjunction with one another to specify the beginning and ending of the loop. The Exit DO statement may be used to break out of the loop.
Syntax
Defaults
1.) When no WHILE or UNTIL condition is specified, execute. 2.) The loop until the LOOP statement's conditions or an Exit DO indicate otherwise.
Parameters
The WHILE keyword indicates that the loop should be executed only if the specified conditional expression evaluates to true. If the conditional expression evaluates to false, execution will skip to the first line following the LOOP statement.
The UNTIL keyword indicates that the loop should be executed only if the specified conditional expression evaluates to false. If the conditional expression evaluates to true, execution will skip to the first line following the LOOP statement.
The word DO on the DO statement is optional when WHILE or UNTIL is specified. Business Rules will insert the word DO. CONFIG STYLE INDENT will cause lines between the DO and LOOP statements to be indented.
Example
This do loop waits for Check Boxes to be selected before the operator pushes a "Done" Button.
00350 do 00360 input fields "22,14,CHECK 8,,10;23,14,CHECK 8,,11;24,14,CHECK 8,,12": Box$(1),Box$(2),Box$(3) 00370 print fields "24,1,N 2": Fkey 00380 loop While Fkey~=99