Different from (!=)
The !=
operator
checks for non-equality of two expressions or for two record variables.
Syntax 1: Expression comparison
expr != expr
- expr can be any expression supported by the language.
Syntax 2: Record comparison
record1.* != record2.*
- record1 and record2 are records with the same structure.
Usage
The !=
operator evaluates
whether two expressions or two records are different.
<>
is a synonym for !=
.A less-than
sign followed by a greater-than sign (<>
) can
be used as an alias for the !=
operator.
The syntax comparing two expressions applies to most data types, except complex types like BYTE
and TEXT
.
When comparing simple expressions (expr !=
expr
), the result of the operator is NULL
when one of
the operands is NULL
.
When comparing two records with the second syntax, the
runtime system compares all corresponding members of the records. If one pair of members are
different, the result of the operator is TRUE
. When two corresponding members are
NULL
, they are considered as equal. This second syntax allows you to compare all
members of records, but records must have the same structure.
Example
MAIN
DEFINE n INTEGER
LET n==512
IF n!=32 THEN
DISPLAY "The variable is not equal to 32."
END IF
END MAIN