<< Prev        Next >>

ID : 9856

Conditional Expression

A conditional expression refers to an expression to judge whether a designated content is True or False.

Normally, it is designated along with a comparative operator and True is returned if the relation is established, or False if not.

E.g.
True
9 = 27 / 3
5 < 27 / 3
False
9 = 37 / 3
5 > 28 / 3

Statements that mainly use the conditional expression are "If...Then...Else", "Do...Loop" and others.

If a Numeric Value is Included in a Conditional Expression Request

A numeric value can be designated when a conditional expression is requested by a statement.

A value other than 0 is interpreted as "True" and 0 is interpreted as "False."

A conditional expression converts designated data into integer type data and judge whether the value is "0" (= False) or other than "0" (= True).

If a designated value is "0.4," data type is automatically converted (casted) into integer type and the value becomes "0," i.e. False.

E.g.

If 0.4 Then
    PrintDbg "True."
Else
    PrintDbg "False."
End If

In case of I/O Type data, "On" is "1" which is "other than 0" and therefore interpreted as "True," while "Off" is "0" so interpreted as "False."

ID : 9856

<< Prev        Next >>