Bool

Coerces a value to a boolean using StoryBonsai’s boolean-coercion rule. This is the explicit form of the same coercion the runtime applies implicitly inside If(), &&, ||, and Visible when expressions.

Category: Type Returns: bool

Signature

Bool(value)

Examples

Bool(var_score)                            // false when the value is 0; true otherwise
Bool(var_player_name)                      // false on an empty string; true otherwise
Bool(var_reply_text) && Bool(var_score)
                                            // mix a text source and a number source in one gate

Notes

The coercion rule: 0, 0.0 (as numbers), the empty string, and the exact text "false" (case-insensitive) coerce to false. Everything else (any non-zero number, any other non-empty string) coerces to true. A string holding the text "0" is not empty and is not "false", so it coerces to true, not false. See Expressions for the full rule.

Docs last synced: 2026-07-08
Screenshot viewer