Ordering (<, <=, > , >=)
Airscript supports the following ordering comparison operators: greater than (>
), greater than or equal to (>=
), less than (<
), and less than or equal to (<=
).
Numbers
When comparing the ordering of Numbers, ordering operators output TRUE
if the described relationship is true, and FALSE
is the described relationship is false. For example, the fact that 2 is greater than 1 results in the following:
Times
When comparing the ordering of Time values, ordering operators consider the time later in the day to be "greater than" the other.
For the sake of example, say that there are two Time variables, defined as follows:
time2
represents a time of day that is over an hour after time1
. This means that time2
is greater than time1
:
Likewise, time1
is less than time2
:
Dates
When comparing the ordering of Date values, ordering operators consider the later date to be "greater than" the other.
For the sake of example, say that there are two Time variables, defined as follows:
date2
represents day that comes after date1
. This means that date2
is greater than date1
:
Likewise, date1
is less than date2
:
DateTimes
When comparing the ordering of DateTime values, ordering operators consider the later described time to be "greater than" the other.
For the sake of example, say that there are two DateTime variables, defined as follows:
datetime2
represents a time that comes after datetime1
. This means that datetime2
is greater than datetime1
:
Likewise, datetime1
is less than datetime2
:
Note that while both datetime1
and datetime2
are in the same timezone, this does need to be the case in order for the comparison operators to properly compare them. For instance, say there is another DateTime variable, defined as follows:
datetime3
represents the exact same time as datetime2
, just in the Africa/Dar_es_Salaam timezone rather than UTC:
Currencies
When comparing the ordering of Currencies, ordering operators compare the described currency value, taking precision into account. Currencies with different currency codes cannot be compared; Airscript will throw an error.
For the sake of example, say that there are two Currency variables, defined as follows:
currency_1
represents ten US dollars while currency_2
represents thirty US dollars. This means that currency_2
is greater than currency_1
:
Likewise, currency_1
is less than currency_2
:
Note that while both currency_1
and currency_2
compare currency with the same values ofprecision
, this does need to be the case in order for the comparison operators to properly compare them. For instance, say there is another Currency variable, defined as follows:
currency_3
represents thirty US dollars, just likecurrency_2
does; the only difference is precision:
Strings
When comparing the ordering of strings, ordering operators compare lexicographical order.
When a string is "greater than" another, this means that it comes after the other string in lexicographical order. For instance, the string "airscript" comes after the string "air" in lexicographical order, meaning that "airscript" is greater than "air". This results in the following:
Similarly, when a string is "less than" another, this means that it comes before the other string in lexicographical order. For instance, the string "air" is less than the string "airscript". This results in the following:
Last updated