If...Then~Elseif~Else~Endif

Controls the flow of processing in accordance with the judgement conditions of the logical expression.

If <Logical Expression> Then
    <Then statement within the block>
[Elseif <Logical Expression> Then
    <Elseif statement within the block>
    ~]
[Else
    <Else statement within the block>]
Endif

Parameters
<Logical Expression>
The logical expression (Boolean expression) for controlling processing.
<Then statement within the block>
The statement to be executed (statement) when the result of the <Expression> after If is true.
<Elseif statement within the block>
The statement to be executed (statement) when the result of the <Expression> after Elseif is true.
<Else statement within the block>
The statement to be executed (statement) when all the <Expressions> are false.

Return Value
None.

Description
Controls the flow of processing in accordance with the Logical Expression.
If the condition of the <Logical Expression after If is true (other than 0), the <Then statement within the block> right after it is executed.Refer to refCalculation - Macro Program Rules for details on logical expressions and Boolean values.
If the condition of the <Logical Expression after Elseif is true (other than 0), the <elseifstatement within the block> right after it is executed.
When all of the <Logical Expressions> are false, the elsestatement within the block> is executed.
Multiple Elseif clauses can be used. It is also possible to omit it.
The Else clause can be omitted.
The Endif statement cannot be omitted.
When multiple <Logical Expressions> are true, the statement within the block of the first <Logical Expression> that is true is executed.
Moving control from outside the select block to the inside or moving control from inside it to the outside using statements such as the goto statement is not possible.

Example
Reference the correlation value and change the message to be displayed on the monitor.
    GetUnitData 1,"CR",RESULT&
    If RESULT&>=80 Then 
    DrawTextG "Excellent",100,100,0
    Elseif RESULT&>=60 Then
    DrawTextG "Good",100,100,0
    Else
    DrawTextG "Bad",100,100,0
    EndIf