Bool Block
Output a boolean constant or convert an input value into a boolean
Overview
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.
Inputs
The value to be converted to a boolean. This input is only available if “Use Value Input” is enabled.
Outputs
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.
Editor 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.
Conversion Rules
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.
Example: Using a Constant Boolean Value
- Add a Bool Block to your flow.
- Set the
Value
setting totrue
. - Run the flow. The
Value
output of the Bool Block will betrue
.
Example: Converting an Input to a Boolean
- Add a Bool Block to your flow.
- Enable the
Use Value Input
setting. - Add a Text Block to your flow and set the text to
"Hello"
. - Connect the output of the Text Block to the
Input
of the Bool Block. - Run the flow. The
Value
output of the Bool Block will betrue
, because the string"Hello"
is a truthy value in JavaScript.
Error Handling
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.