| Genius Manual | ||
|---|---|---|
| <<< Previous | Programming with GEL | Next >>> |
==, >=, <=, !=, <>, <, > return true or false.
!= and <> are the same thing and mean "is not equal to".
Normally = is translated to == if it happens to be somewhere where GEL is expecing a condition such as in the if condition. For example
if a=b then c if a==b then c |
All the comparison operators (except for the <=> operator which behaves normally), are not strictly binary operators, they can in fact be grouped in the normal mathematical way, e.g.: (1<x<=y<5) is a legal boolean expression and means just what it should, that is (1<x and x≤y and y<5)
The <=> operator returns -1 if left side is smaller, 0 if both sides are equal, 1 if left side is larger.
To build up logical expressions use the words not, and, or, xor.
"or" and "and" are special beasts as they evaluate their arguemnts one by one, so the usual trick for conditional evaluation works here as well. (e.g., "1 or a=1" will not set a=1 since the first argument was true)
| <<< Previous | Home | Next >>> |
| Sums and products | Up | Returning |