Skip to content

Type Bool

The type::bool function converts a value to a boolean. If the input can be interpreted as a boolean (e.g., true, false, or numbers like 1 or 0), it returns the corresponding boolean value. Otherwise, it returns an error.

Syntax

type::bool(<value>)

Parameters

  • value: The input value to convert to a boolean.

Returns

  • Boolean: The converted boolean value if successful.

Example

Try it out below!
type::bool("true")

This function is useful for ensuring that values are explicitly boolean, enabling consistent logical operations.