Output a boolean constant or convert an input value into a boolean
The Bool Block is used to output a boolean constant or convert an input value into a boolean. It’s particularly useful when you need to create a boolean value for use in other blocks, such as the If Block or If/Else Block.
The value to be converted to a boolean. This input is only available if “Use Value Input” is enabled.
The boolean value. If “Use Value Input” is enabled, this will be the input value converted to a boolean. Otherwise, outputs the constant value specified in settings.
The constant boolean value to output. This setting is only available if “Use Value Input” is disabled.
If enabled, the block will convert an input value to a boolean. If disabled, the block will output the constant boolean value specified in the Value setting.
The width of the block in pixels.
Whether the block is hidden in the block menu.
The Bool Block follows JavaScript’s rules for truthy and falsy values when converting input values to booleans. If no input is connected when “Use Value Input” is enabled, it will fall back to using the Value setting.
Value
setting to true
.Value
output of the Bool Block will be true
.Use Value Input
setting."Hello"
.Input
of the Bool Block.Value
output of the Bool Block will be true
, because the string "Hello"
is a truthy value in JavaScript.The Bool Block cannot error under normal circumstances. If “Use Value Input” is enabled and no input is connected, the block will fall back to using the Value setting.
What values are considered truthy and falsy in JavaScript?
The following values are considered falsy:
false
0
''
(empty string)null
undefined
NaN
All other values are considered truthy.
What happens if no input is connected when Use Value Input is enabled?
The block will fall back to using the Value setting specified in the editor settings.
Output a boolean constant or convert an input value into a boolean
The Bool Block is used to output a boolean constant or convert an input value into a boolean. It’s particularly useful when you need to create a boolean value for use in other blocks, such as the If Block or If/Else Block.
The value to be converted to a boolean. This input is only available if “Use Value Input” is enabled.
The boolean value. If “Use Value Input” is enabled, this will be the input value converted to a boolean. Otherwise, outputs the constant value specified in settings.
The constant boolean value to output. This setting is only available if “Use Value Input” is disabled.
If enabled, the block will convert an input value to a boolean. If disabled, the block will output the constant boolean value specified in the Value setting.
The width of the block in pixels.
Whether the block is hidden in the block menu.
The Bool Block follows JavaScript’s rules for truthy and falsy values when converting input values to booleans. If no input is connected when “Use Value Input” is enabled, it will fall back to using the Value setting.
Value
setting to true
.Value
output of the Bool Block will be true
.Use Value Input
setting."Hello"
.Input
of the Bool Block.Value
output of the Bool Block will be true
, because the string "Hello"
is a truthy value in JavaScript.The Bool Block cannot error under normal circumstances. If “Use Value Input” is enabled and no input is connected, the block will fall back to using the Value setting.
What values are considered truthy and falsy in JavaScript?
The following values are considered falsy:
false
0
''
(empty string)null
undefined
NaN
All other values are considered truthy.
What happens if no input is connected when Use Value Input is enabled?
The block will fall back to using the Value setting specified in the editor settings.