operators, precedence, and associativity

Langur uses the following, in order of descending precedence.

category operators associativity
function call
not grouping
() left
index
not array literals
[] left
prefix -
exponent ^ ^/ right
product x / \ // left
sum + - left
range .. to left
concatenate ~ (tilde) left
less/greater < <= > >=
<? <=? >? >=?
left
logical negation not
not?
equality == !=
==? !=?
left
logical and and
and?
left
logical equality xor leq
xor? leq?
left
logical or or
or?
left
assignment = right

See the numbers page for math operator descriptions.

database operators

Normal operators treat null as an ordinary value (don't favor propogating null). Testing null == null returns true and null == false returns false.

Operators ending with ? are database operators. For these, if either side is null, the result is null. Testing null ==? anything returns null.

NaN comparison

Testing NaN == NaN returns false, and NaN ==? null returns null. The isNaN() function may be helpful here.

composite comparisons

Items of the same type (arrays, hashes, or ranges) may be directly compared for equality or inequality.

These comparisons are affected by the NaN issue, which may need further review.

short-circuiting operators

The and and or operators are short-circuiting.

Database operators are short-circuiting in a different manner (only if the left value is null). This includes the and? and or? operators.