Builtin Function: compare
compare(value1, value2)
The built-in function compare
compares two values. The only valid types that
can be provided are integers, floats or strings. Strings are compared according
to lexicographic ordering; which is comparable to alphabetical
ordering, but also takes into account symbols.
The following table provides an overview of the possible return values:
Result | Description |
---|---|
-1 | value1 is less than value2 |
0 | value1 is equal to value2 |
+1 | value1 is greater than value2 |
Examples