YASS supports mathematical and logical expressions using familiar symbolic operators and readable word-based alternatives. These expressions are evaluated by LAME X3 (Logic And Mathematics Evaluator X3).
Mathematical expressions
Mathematical expressions follow the conventional order of operations. Parentheses can be used to make the intended evaluation order explicit.
$a = 84 + 43 * 2 $b = (91 - 22) % $a $c = 10 div 3
| Operator | Purpose | Example |
|---|---|---|
+ |
Addition | 5 + $v |
- |
Subtraction | 10 - $v |
* |
Multiplication | 3 * $v |
/ |
Division | 50 / $v |
div |
Floor division | 10 div $v |
% |
Modulo (remainder) | 10 % $v |
^ |
Exponentiation | 2 ^ $v |
Floor division
The div operator divides two numbers and rounds the result down to the nearest
integer. Negative results therefore round towards negative infinity, not towards zero.
print(10 div 3) // 3 print(-10 div 3) // -4 print(7.5 div 2) // 3
Floor division has the same precedence as *, / and %. It is
left-associative, and using zero as the divisor produces a runtime error.
Operator precedence
Parentheses are evaluated first, followed by exponentiation. Multiplication, division, floor division and modulo are evaluated before addition and subtraction. Operators at the same precedence level are evaluated from left to right, except exponentiation.
Logical expressions
Logical operators combine or invert Boolean values. YASS provides symbolic and word-based forms of each operator; the two forms have the same behaviour.
$a = true && false $b = true OR false $c = NOT false
| Operator | Purpose | Result |
|---|---|---|
&& or AND |
Logical AND | True only when both operands are true |
|| or OR |
Logical OR | True when at least one operand is true |
! or NOT |
Logical NOT | Inverts a Boolean value |
Comparisons produce Boolean values and can be combined with logical operators. Parentheses are recommended when combining several comparisons so that the intended grouping is clear.
$can_continue = ($age >= 18 AND $has_access) OR $is_admin
See the conditions page for the comparison operators supported by YASS.
Expression evaluator history
Real Math Mode introduced standard mathematical expressions in version 1.3.5.60, replacing the original arithmetic inline functions. LAMP (Logic And Mathematics Parser) replaced it in version 1.4.3 and added logical evaluation. LAME followed in version 1.7.1, LAME X2 in version 1.12.3, and LAME X3 is the current evaluator.

There are no comments on this page.
Comments are welcome and encouraged, including disagreement and critique. However, this is not a space for abuse. Disagreement is welcome; personal attacks, harassment, or hate will be removed instantly. This site reflects personal opinions, not universal truths. If you can’t distinguish between the two, this probably isn’t the place for you. The system temporarily stores IP addresses and browser user agents for the purposes of spam prevention, moderation, and safeguarding. This data is automatically removed after fourteen days. Your email address is stored so that replies can be sent to your email address.
Comments powered by BalfComment