bool
Syntax
bool bool(value)
Parameters
- value (float, bool, string)
Value to convert.
Returns
A boolean value calculated from value.
Description
This function converts value to the corresponding boolean value. Float values are false if they are equal to 0, true otherwise. Strings are false if equal to "f", "false", "0", 0.0" etc, true otherwise.
Related
- float function
- str function
- floatArray function
- boolArray function
- stringArray function
Examples
bool(1)
# result = true
bool(0)
# result = false
bool("1")
# result = true
bool(6.66)
# result = true
bool("false")
# result = false
bool("f")
# result = false
bool("true")
# result = true
bool("beneath the remains")
# result = true
bool(11.5 == 0)
# result = false
Copyright ©2008-2025 Esri R&D Center Zurich. All rights reserved.