truthy¶
Info
New in Atfinity 17.
Description¶
truthy converts a value into a boolean, returning true only for values that clearly represent "true". It is useful when a value comes in as a number or a string (for example from an imported field) and you want to interpret it as a boolean.
truthy returns true for:
- the boolean
true - the number
1 - the strings
"1"and"true"— case-insensitive and trimmed of surrounding whitespace (so" TRUE "also counts)
For any other value it returns false. In particular, numbers other than 1 (such as 2) and unrecognised strings (such as "yes" or "maybe") are not truthy.
If the value is unknown, the result is unknown.
Warning
truthy and falsy are not exact opposites. A value like 2 or "maybe" is neither truthy nor falsy — both operators return false for it.