Comparative and logical operators and functions
We assume that the logical false is represented by zero and the logical true is represented by the
value different from zero. Note: If a function takes more than one argument, the arguments are separated with semicolon ';'.
- x < y
- This operator returns one if x is lower than y else it returns zero. For example:
4 < 10 = 1
6 < 2 = 0
- x > y
- This operator returns one if x is greater than y else it returns zero. For example:
5 > 2 = 1
5 > 8 = 0
- x <= y
- This operator returns one if x is lower than or equal to y else it returns zero. For example:
4 <= 4 = 1
7 <= 2 = 0
- x >= y
- This operator returns one if x is greater than or equal to y else it returns zero. For example:
5 >= 5 = 1
3 >= 4 = 0
- x == y
- This operator returns one if x is equal y else it returns zero. For example:
4 == 4 = 1
6 == 2 = 0
- x != y
- This operator returns one if x is different from y else it returns zero. For example:
5 != 2 = 1
5 != 5 = 0
- x && y (logical and)
- This operator returns one if both x and y are different from zero else it returns zero. For example:
4 && 10 = 1
6 && 0 = 0
0 && 0 = 0
- x || y (logical or)
- This operator returns one either if x or y are different from zero else it returns zero. For example:
5 || 2 = 1
0 || 3 = 1
0 || 0 = 0
- if(condition; if_true; if_false)
- If the 'condition' is true (different from zero) the function returns 'if_true' else it returns 'if_false', e.g.
if( 0 ; 20 ; 30) = 30
if( 1 ; 20 ; 30) = 20
if( 4<5 ; 10 ; 50) = 10
if( 6>10 ; 200 ; 100) = 100
- and(x ; y)
- This function does the same thing as the logical operator 'and' (&&)
- or(x ; y)
- This function does the same thing as the logical operator 'or' (||)
- not(x)
- If the x is true (different from zero) this function returns zero, otherwise it returns one, e.g.
not(15)=0
not(0)=1