The equality operator, accessed via the symbol =
, returns TRUE
when two values are the same, and FALSE
when they are not the. For example, consider the following expressions:
2 = 2 -> TRUE
2 = 1 -> FALSE
"Airscript" = "Airscript" -> TRUE
"Airscript" = "airscript" -> FALSE
Comparing two values of different type will always be FALSE
, for example:
2 = "Airscript" -> FALSE
It is important to be careful when comparing two complex values such as Currencies, Times, Dates, and DateTimes. The result will only be TRUE
if the two values are exactly the same rather than just similar. For example, note that the following two Currency values are not considered equal by the equality operator, even though they both represent 40 US dollars, because one gives the monetary value in cents while the other gives it in dollars:
{
"amount": 4000,
"code": "USD",
"precision": 2
} = {
"amount": 40,
"code": "USD",
"precision": 0
} -> FALSE