Evaluates <expression> and returns its result.
If <expression> is a single string, array or hash, it is returned unmodified.
In any other case the expression evaluation returns a numeric value, either real or integer.
The expressions are really close to the C ones and have some minor extensions.
The supported operators are +,-,*,/,|,&,^,||,&&,^^,>>,<<,<,>,<=,>=,==,!= and <> (synonim for !=).
The following table describes their meaning.
Operator | Description |
a + b | Arithmetic sum: valid only for numeric operands |
a - b | Arithmetic subtraction: valid only for numeric operands |
a / b | Arithmetic division: valid only for numeric operands |
a * b | Arithmetic multiplication: valid only for numeric operands |
a % b | Arithmetic modulus: valid only for numeric operands |
a || b | Logical or: valid only for boolean operands |
a && b | Logical and: valid only for boolean operands |
a ^^ b | Logical xor: valid only for boolean operands |
a >> b | Bitwise shift right: valid only for integer operands |
a << b | Bitwise shift left: valid only for integer operands |
a | b | Bitwise or: valid only for integer operands |
a & b | Bitwise and: valid only for integer operands |
a ^ b | Bitwise xor: valid only for integer operands |
a > b | Greater than: valid for numeric or string operands. Case sensitive |
a < b | Lower than: valid for numeric or string operands. Case sensitive |
a >= b | Greater or equal to: valid for numeric or string operands. Case sensitive |
a <= b | Lower or equal to: valid for numeric or string operands. Case sensitive |
a != b | Not equal to: valid for numeric or string operands. Case sensitive |
a == b | Equal to: valid for numeric or string operands. Case sensitive |
The expressions can contain integer, real or string constants and variable operands.
The integer constants can be also specified as hexadecimal numbers by prefixing them by '0x'.
The string constants should be enclosed in quotes.
|