
Chapter 12 Device Logic (Pawn)
12.5.5.6 Comparative operators
A logical "false" is represented by an integer value of 0; a logical "true" is represented by a value that is not 0.
Results of a comparative expression are either 0 or 1 and the "tag" is set to "bool".
Operator Example
Explanation
==
e1 == e2 The result is "true" if e1 and e2 are the same.
!=
e1 != e2
The result is "true" if e1 and e2 are not the same.
Note:
The following operators can be linked, the same as in the expression "e1 <= e2 <= e3". This
means that the result is "1" if every single comparison is true and "0" if at least one comparison is false.
Operator Example
Explanation
<
e1 < e2
The result is a logical "true" if e1 is less than e2.
<=
e1 <= e2 The result is a logical "true" if e1 is less or equal to e2.
>
e1 > e2
The result is a logical "true" if e1 is greater than e2.
>=
e1 >= e2 The result is a logical "true" if e1 is greater or equal to e2.
12.5.5.7 Boolean
A logical "false" is represented by an integer value of 0; a logical "true" is represented by a value that is not 0.
Results of a comparative expression are either 0 or 1 and the "tag" is set to "bool".
Operator Example
Explanation
!
!e
The result is a logical "true", if e is logical "false".
||
e1 || e2
The result is "true", if either e1 or e2 (or both) are logical "true". The expression e2 is
only evaluated if e1 is logical "false".
&&
e1 && e2 The result is "true" if e1 and e2 are logical "true". The expression e2 is only evaluated if
e1 is logical "true".
Rev. 01
171