Booleans are either true
or false
.
Other types can convert to bool
by using the !
(not) operator or the bool function.
The bool() documentation contains a helpful example table to explain how different types are converted to bool.
This code creates a bool property is_the_earth_flat to collection stuff:
.is_the_earth_flat = !true;
Function | Description |
---|---|
bool | Convert a value into type bool. |
is_bool | Test if a given value is of type bool. |