Boolean to integer
Type conversion
Pure
Boolean to integer
Value
false
Result
Description
Pure function returning 1 for true and 0 for false.
When to use
Use Boolean to integer when you need to accumulate or count boolean flags — for example, summing a set of condition results to get a total number of matched items. It is also useful when an external API or system expects 0/1 rather than a boolean type. For the reverse conversion, use Integer to boolean.
Pins
Input pins
| Pin | Type | Default | Notes |
|---|---|---|---|
| Value | boolean | false | The boolean to convert. true maps to 1; false maps to 0. |
Output pins
| Pin | Type | Notes |
|---|---|---|
| Result | integer | 1 if value is true; 0 if value is false. |
Example
Count how many items in a loop pass a validation check. On each iteration, feed the boolean validation result into the Value input of Boolean to integer. The Result output (1 for true, 0 for false) is then added to a running total using Add, yielding the count of valid items after the loop completes.