If...Then~Else
Controls the flow of processing in accordance with specified conditions.
If <Logical Expression> Then <Statement>|<Label> [Else <Statement>|<Label>]
Parameters
<Logical Expression>
|
The logical expression (Boolean expression) for controlling processing.
|
<Statement>
|
The command statement to be processed (statement).
|
<Label>
|
Label (Label) for the movement destination.
|
Return Value
None.
Description
Controls the flow of processing in accordance with the Logical Expression.
While the <Logical Expression> value is true (not 0), either the statement below the Then <statement> is executed or the processing is moved to the line specified by the <Label>.Refer to
Calculation - Macro Program Rules for details on logical expressions and Boolean values.
Specifying a <Label> after Then will move the processing to the Label.
Specifying a statement after Then will execute that statement.
When the <Logical Expression> value is true (not 0), processing is moved to the line after the Else <statement> or to the line specified by the<Label>.
The Else statement can be omitted.
The Else statement may not be written on the next line.Describe the If - Else all in one statement.
Example
Output the judge result of CameraImageInput.
If UnitJudge(0)=1 Then Gosub *OKOUT Else Gosub *NGOUT
Return
*OKOUT
Print "OK"
Return
*NGOUT
Print "NG"
Return
Stop