4.4.6 If/ElseIf/Else
The [If] command allows you to create a condition for determination of the program block.
The [ElseIf] command allows you to create a condition for determination of the program block under the If
node.
The [Else] command allows you to create a program block under the If
or ElseIf
node.
1. Setting
If
setting:
Tap the expression in the
If
interface to edit the condition expression.Check expression continuously: Once checked, the condition expression will be continuously checked during execution of the
If
program block, and once the expression is determined to be false, theIf
program block will be skipped at any time.
ElseIf
setting:
Tap the expression in the
ElseIf
interface to edit the condition expression.Check expression continuously: Once checked, the condition expression will be continuously checked during execution of the
ElseIf
program block, and once the expression is determined to be false, theElseIf
program block will be skipped at any time.
2. Application
If
: If theIf
condition is true, theIf
program block will be executed.If...Else...
: If theIf
condition is true, the program inside thisIf
node will be executed; otherwise the program in theElse
node will be executed.If...ElseIf...Else...
: If theIf
condition is true, the program inside thisIf
node will be executed; otherwise whether theElseIf
condition is true will be determined. If theElseIf
condition is true, the program inside theElseIf
node will be executed; otherwise the program inside theElse
node will be executed.
var_0
. The program starts execution and runs to Waypoint_0
. Determine whether var_0
is less than or equal to 2. If var_0
is less than or equal to 2, execute MoveJ
with the comment "left". If var_0
is greater than 2, determine whether var_0
is less than or equal to 5. If var_0
is greater than 2 and less than or equal to 5, execute MoveJ
with the comment "right". If var_0
is greater than 5, execute MoveJ
with the comment "Up".