Carrot reference
Functions

boolean()

Converts supported datatypes into a Boolean, equal to either true or false.

Syntax

boolean(value)

  • value - the value to be evaluated by the function.
  • Return type: Boolean.

Sample usage

boolean(0) returns false.

boolean("yes") returns true.

Supported data types

Input type

Return type

Logic

String

Boolean

String values that start with y or t return true. String values that start with n or f return false.

Number

Boolean

Number values equal to 0 return false. Non-zero Number values return true.

Boolean

Boolean

Boolean values remain unchanged.

Unsupported type

Null

Unsupported data types return Null.



Updated 04 Oct 2023
Doc contributor
Doc contributor
Did this page help you?