Propeller Manual

Table Of Contents
Operators – Spin Language Reference
Here, X is compared with Y, and if they are equal, X is set to TRUE (-1), otherwise X is set to
FALSE (0). The assignment form of Is Equal may also be used within expressions for
intermediate results; see Intermediate Assignments, page 147.
Boolean Is Not Equal ‘
<>’, ‘<>=
The Boolean operator Is Not Equal compares two operands and returns True (-1) if the values
are not the same, or returns
FALSE (0), otherwise. Is Not Equal can be used in both variable
and constant expressions. Example:
X := Y <> Z
The above example compares the value of Y with the value of Z and sets X to either: TRUE (-1)
if
Y is not the same value as Z, or FALSE (0) if Y is the same value as Z.
This operator is often used in conditional expressions, such as in the following example.
IF (Y <> 25)
Here, the Is Not Equal operator returns TRUE if Y is not 25.
Is Not Equal has an assignment form,
<>=, that uses the variable to its left as both the first
operand and the result destination. For example,
X <>= Y 'Short form of X := X <> Y
Here, X is compared with Y, and if they are not equal, X is set to TRUE (-1), otherwise X is set to
FALSE (0). The assignment form of Is Not Equal may also be used within expressions for
intermediate results; see Intermediate Assignments, page 147.
Boolean Is Less Than ‘
<’, ‘<=
The Boolean operator Is Less Than compares two operands and returns
TRUE (-1) if the first
value is less than the second value, or returns
FALSE (0), otherwise. Is Less Than can be used
in both variable and constant expressions. Example:
X := Y < Z
The above example compares the value of Y with the value of Z and sets X to either: TRUE (-1)
if
Y is less than the value of Z, or FALSE (0) if Y is equal to or greater than the value of Z.
This operator is often used in conditional expressions, such as in the following example.
IF (Y < 32)
Page 170 · Propeller Manual v1.1