Boolean | BOOLEAN
Syntax
BOOLEAN( [input], [default = false] )
Parameters
input
Any data may be used as the input.
default
The default value if INPUT cannot be converted to a BOOLEAN value.
If the default value is used, it will be converted to a BOOLEAN value before being returned.
The default value will only be used if VALUE is UNDEFINED or NULL.
Return Value
VALUE is converted to a BOOLEAN value and returned.Description
Converts a value to either TRUE or FALSE. The following rules are used when doing the conversion:- TRUE and FALSE are returned as is
- The TEXT values "true", "TRUE", "True" and "1" are returned as TRUE
- The TEXT values "false", "FALSE", "False", "0", and "" are returned as FALSE
- The value 0 is returned as FALSE
- The values NULL and UNDEFINED are converted to the provided DEFAULT
- All other values are returned as TRUE
Examples
BOOLEAN(true) # returns TRUE
BOOLEAN(false) # returns FALSE
BOOLEAN(null) # returns FALSE
BOOLEAN(undefined) # returns FALSE
BOOLEAN(null, true) # returns TRUE
BOOLEAN(undefined, true) # returns TRUE
BOOLEAN(null, 1) # returns TRUE
BOOLEAN(1) # returns TRUE
BOOLEAN(0) # returns FALSE
BOOLEAN("FALSE") # returns FALSE
BOOLEAN("TRUE") # returns TRUE
BOOLEAN([]) # returns TRUE
BOOLEAN(MAP()) # returns TRUE