Expressions
Expressions calculate equations and formulas and return a single value as a result. The expression must contain numbers or strings surrounded by quotation marks. Floating-point precision data is accepted and calculated correctly by the expression-handling engine, but EaxiaSEL can only store whole-number integer data (so rounding down will always occur upon assignment). Expressions will result in $result being set to 1 if there is an error with your syntax. The following conditions can result in error:
- There are a mismatched number of parenthesis in the expression.
- There are symbols in the expression that are not recognized.
- An expression does not make logical sense. Example: (14 / 7) * (+ 1)
- An attempt to divide a number by zero is made. Since modulo relies on division, modulo expressions that divide by zero are also errors.
- Operations on two unlike data types are made that do not make sense. For example: (5 + 2) And "Hello"
- There are mismatched quotation marks.
Allowed expression operations on numeric values:
Expression | Operation Type |
a + b | returns the result of adding 'b' to 'a' |
a - b | returns the result of subtracting 'b' from 'a' |
a * b | returns the result of multiplying 'b' with 'a' |
a / b | returns the result of dividing 'b' into 'a' |
a % b | returns the modulo of 'a' divided by 'b' |
a == b | returns true if 'a' is equal to 'b' |
a != b | returns true if 'a' is not equal to 'b' |
a > b | returns true if 'a' is greater than 'b' |
a >= b | returns true if 'a' is greater than or equal to 'b' |
a < b | returns true if 'a' is less than 'b' |
a <= b | returns true if 'a' is less than or equal to 'b' |
a && b | returns true if both evaluations are true (logical AND) |
a || b | returns true if either evaluations are true (logical OR) |
a ! b | returns true if the 'a' evaluation is true and the 'b' evaluation is false (logical NOT) |
a Xor b | returns true if either evaluations are true but not both evaluations (logical XOR) |
a $$ b | returns true if 'a' is an abbreviation of 'b', not case-sensitive (note: "", an empty string, is an abbreviation for everything) |
a ## b | returns true if 'b' is a substring of 'a' |
a #@ b | returns true if 'b' is a substring of 'a', not case-sensitive |
a =@ b | returns true if 'a' is equal to 'b', not case-sensitive |
a !@ b | returns true if 'a' is not equal to 'b', not case-sensitive |
Allowed expression operations on mixed values (text and numeric):
Expression | Operation Type |
a == b | returns true if 'a' is equal to 'b' |
a != b | returns true if 'a' is not equal to 'b' |
a > b | returns true if 'a' is greater than 'b' |
a >= b | returns true if 'a' is greater than or equal to 'b' |
a < b | returns true if 'a' is less than 'b' |
a <= b | returns true if 'a' is less than or equal to 'b' |
a && b | returns true if both evaluations are true (logical AND) |
a || b | returns true if either evaluations are true (logical OR) |
a ! b | returns true if the 'a' evaluation is true and the 'b' evaluation is false (logical NOT) |
a Xor b | returns true if either evaluations are true but not both evaluations (logical XOR) |
a $$ b | returns true if 'a' is an abbreviation of 'b', not case-sensitive (note: "", an empty string, is an abbreviation for everything) |
a ## b | returns true if 'b' is a substring of 'a' |
a #@ b | returns true if 'b' is a substring of 'a', not case-sensitive |
a =@ b | returns true if 'a' is equal to 'b', not case-sensitive |
a !@ b | returns true if 'a' is not equal to 'b', not case-sensitive |
Substitute operations:
Operation | Valid substitute operation |
And | && |
Or | || |
Not | ! |
* | x |
<> | = |
Note that empty parenthesis, excessive parenthesis, and parenthesis that contain values but no expressions are considered valid expressions. For example, (((4))) + () / (1 + 1) will evaluate to 2 because () is considered 0.
Example expressions:
Expression | Evaluation |
2 * (6 - 4) | 4 |
(((-3 * (1 + -2)) + 6) / 3) * -(2 + 3) | -15 |
("asdf" == "asdf") Not (1 > 1) | 1 |
("5" = 5) And ("Bob" != "Fred") And (2 > 3) | 0 |
Boolean (true/false) results are 1 for TRUE and 0 for FALSE.