Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

bool

Converting and combining truth values. See Truth values for the rules.

bool.TRUE, bool.FALSE

bool.TRUE -> Bool
bool.FALSE -> Bool

The two boolean values, the same as the root names TRUE and FALSE.

bool.TRUE == TRUE    # => TRUE

bool.from

bool.from value -> Bool

Returns the truth value of value: FALSE for FALSE, 0, "", [], {}, undefined values and pending promises, TRUE for everything else.

bool.from 0          # => FALSE
bool.from "no"       # => TRUE
bool.from (0, 1)     # => (FALSE, TRUE)

bool.any

bool.any items -> Bool

Returns TRUE if at least one item of the tuple items is true. It reduces the whole tuple to one value, so bool.any () is FALSE.

bool.any (0, "", 3)  # => TRUE
bool.any (0, "")     # => FALSE

bool.all

bool.all items -> Bool

Returns TRUE if every item of the tuple items is true. It reduces the whole tuple to one value, so bool.all () is TRUE.

bool.all (1, "a")    # => TRUE
bool.all (1, 0)      # => FALSE
bool.all ([1, 2] == [1, 2], 3 > 2)       # => TRUE