Comparison and Equality
Relational Operators
| Operator | Description |
|---|---|
< | Less than |
<= | Less than or equal |
> | Greater than |
>= | Greater than or equal |
Numbers compare numerically. Strings compare lexicographically (ordinal, case-sensitive).
5 < 10 # true
"abc" < "def" # true
"ABC" < "abc" # true (uppercase sorts before lowercase)
Equality Operators
| Operator | Description |
|---|---|
== | Equal to |
!= | Not equal to |
For primitive values (numbers, strings, booleans, null), equality compares by value. For arrays and objects, equality compares by reference - two distinct arrays or objects with the same contents are not equal under ==.
42 == 42 # true
"hello" == "hello" # true
[1, 2] == [1, 2] # false - different array references
Deep Value Comparison
Use the Equal() standard library function for deep value comparison of arrays and objects:
Equal([1, 2], [1, 2]) # true - compares values recursively
NotEqual([1, 2], [1, 3]) # true
Case Sensitivity
All string comparisons are case-sensitive, including ==, !=, <, >, <=, and >=. Use ToLower() or ToUpper() to perform case-insensitive comparisons:
ToLower("Hello") == ToLower("hello") # true