Compare values and return boolean results.
0
or 1
as UInt8
.
The following types can be compared:
UInt16
and UInt64
) but not across groups (e.g., UInt16
and DateTime
).
Strings are compared byte-by-byte. This may lead to unexpected results if one of the strings contains UTF-8 encoded multi-byte characters.
A string “S1” that has another string “S2” as a prefix is considered longer than “S2”.
=
or ==
operators:
a
(any): The first value to compare.b
(any): The second value to compare.1
if the values are equal, 0
otherwise. [UInt8
]equals
checks if each taco’s price is equal to the standard price of 5.99. The result is 1 for tacos with the standard price and 0 for others.
!=
or <>
operators:
a
(any): The first value to compare.b
(any): The second value to compare.1
if the values are not equal, 0
if they are equal. [UInt8
]notEquals
checks if each taco’s spice level is different from ‘Medium’. The result is 1 for tacos with spice levels other than ‘Medium’ and 0 for Medium spice level.
<
operator:
a
(any): The first value to compare.b
(any): The second value to compare.1
if a
is less than b
, 0
otherwise. [UInt8
]less
checks if each taco’s price is less than 5.00. The result is 1 for tacos priced under 5.00 and 0 for those 5.00 or more.
>
operator:
a
(any): The first value to compare.b
(any): The second value to compare.1
if a
is greater than b
, 0
otherwise. [UInt8
]greater
checks if each taco’s calorie count is greater than 300. The result is 1 for tacos with more than 300 calories and 0 for those with 300 calories or less.
<=
operator:
a
(any): The first value to compare.b
(any): The second value to compare.1
if a
is less than or equal to b
, 0
otherwise. [UInt8
]lessOrEquals
checks if each taco’s preparation time is less than or equal to 5 minutes. The result is 1 for tacos with prep time of 5 minutes or less and 0 for those taking more than 5 minutes.
>=
operator:
a
(any): The first value to compare.b
(any): The second value to compare.1
if a
is greater than or equal to b
, 0
otherwise. [UInt8
]greaterOrEquals
checks if each taco’s rating is greater than or equal to 4.5. The result is 1 for tacos with ratings of 4.5 or higher and 0 for those with ratings below 4.5.