UFH Scalar Expressions
About all you can do with strings at present is to join them together into longer strings. The "+" symbol is used to denote string catenation:
Numbers
For simple numeric operands we provide most of the usual stuff:
| a + b | addition |
| a - b | subtraction |
| a * b | multiplication |
| a / b | division |
| a ^ b | exponentiation |
| a % b | a modulo b |
| -a | unary minus |
Arithmetic is performed in double-precision floating point. Values used as indices are automatically truncated [by conversion to integer]. If you want to convert something explicitly to an integer use int().
Logical and relation operations return 1 if the relation is true and 0 if it is not. Non-zero numeric values are treated as true; zero is treated as false. The relational operators are:
| a > b | greater than |
| a >= b | greater than or equal to |
| a < b | less than |
| a <= b | less than or equal to |
| a == b | equal to |
| a != b | not equal to |
| a || b | or |
| a && b | and |
| !a | logical not |
We also provide the pre / post increment / decrement operators from C
| a++ | post-increment |
| a-- | post-decrement |
| ++a | pre-increment |
| --a | pre-decrement |