Flow Control
Break [Level] |
Will break out of an If/Then, While/Wend or Repeat/Until code block. If the optional Level is specified, will break out of that number of nested flow blocks. |
Continue |
Will skip directly to the start of the code block, skipping any statements between the Continue and the end of the code block |
For <variable> = <expression1> To <expression2> [Step constant] |
Defines a for loop, counting variable from expression1 to expression2, optionally incrementing by Step. The "To" value can be changed inside the loop. |
Next [variable] |
Increments variable and loops through the For loop again. Variable is optional and only included for readability |
ForEach List() | Map() |
Loops through all of the elements in the specified list or map |
Next [List() | Map()] |
Increments the ForEach loop. List() or Map() is optional and only included for readability |
Gosub label |
Send program execution to the code at label, and then the program will resume on the next time |
Return |
Returns to the code following the Gosub call. |
FakeReturn |
If Goto is used inside of a subroutine, you must use FakeReturn before the Goto |
Goto label |
Send program execution to the code at label |
If <expression> |
Starts an If block. The code inside the block will be executed if <expression> evaluates to #True. |
ElseIf <expression> |
An additional If inside an If block, evaluated if the previous If returned #False. |
Else |
The code following Else will be executed if all previous If and ElseIf expressions evaluated to #False |
EndIf |
Ends an If block |
Select <expression> |
Start a Select block and use the value of <expression> for the comparisons |
Case <constant>[, ...] |
Compares the value of the Select expression to <constant> and executes the following code block if it evaluates to #True. |
Default |
A code block to run if none of the previous Case statements evaluated to #True |
EndSelect |
Ends a Select block |
Repeat |
Begins a Repeat block. Unlike If or While, a Repeat block is always executed at least once. |
Until <expression> |
Ends a Repeat block. If <expression> evaluates to #False, will run the Repeat block again until <expression> evaluates to #True |
ForEver |
Ends a Repeat code block and turns it into an infinite loop. Will run forever until the app is killed or a Break statement is encountered |
While <expression> |
Begins a While code block. Will repeat the block until <expression> evaluates to #False. |
Wend |
Ends a While code block |
Only use a single = in expressions, e.g. "If i=0". Do not use Then, which is not a keyword.
You can use ranges in Case statements, e.g. "Case 1 To 8"
You can use ranges in Case statements, e.g. "Case 1 To 8"
Comments
Related