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 f(x) f(x) 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, the If program block will be skipped at any time.

ElseIf setting:

  • Tap the expression f(x) f(x) 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, the ElseIf program block will be skipped at any time.

2. Application

  • If: If the If condition is true, the If program block will be executed.
  • If...Else...: If the If condition is true, the program inside this If node will be executed; otherwise the program in the Else node will be executed.
  • If...ElseIf...Else...: If the If condition is true, the program inside this If node will be executed; otherwise whether theElseIf condition is true will be determined. If the ElseIf condition is true, the program inside the ElseIf node will be executed; otherwise the program inside the Else node will be executed.
Example: Set an initial variable 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".

results matching ""

    No results matching ""