Comparisons
mq provides comparison functionality through built-in functions.
Basic Comparisons
Standard comparison operators are supported:
eq(a, b), a == b
- Returns true ifa
equalsb
ne(a, b), a != b
- Returns true ifa
does not equalb
gt(a, b), a > b
- Returns true ifa
is greater thanb
gte(a, b), a >= b
- Returns true ifa
is greater than or equal tob
lt(a, b), a < b
- Returns true ifa
is less thanb
lte(a, b), a <= b
- Returns true ifa
is less than or equal tob
Examples
# Basic comparisons
1 == 1
# => true
2 > 1
# => true
"a" <= "b"
# => true
# String comparisons
"hello" == "hello"
# => true
"xyz" > "abc"
# => true
# Numeric comparisons
5.5 >= 5.0
# => true
-1 < 0
# => true
# Logical operations
and(true, false)
# => false
or(true, false)
# => true
not(false)
# => true
# Complex conditions
and(x > 0, x < 10)
# => true if 0 < x < 10