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:

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