---
updatedAt: 2026-04-16T21:23:00.000Z
agentTools:
  projectIndex: https://docs.observeinc.com/llms.txt
---

# bool

```
bool(value: numeric or string) -> bool
```

Casts the argument to `bool`. For `int64`, any value other than zero is true. For `float64`, any finite non-zero value is true, while not-a-number and positive or negative infinity yield null `bool`. For `string`, the value is compared case-insensitively to a fixed set of truthy and falsy tokens (including `true`, `false`, `t`, `f`, `yes`, `no`, `y`, `n`, `on`, `off`, `1`, and `0`); other string literals in constant expressions are rejected. A null input produces null `bool`.

# Domain

This is a scalar function (calculates a single output value for a single input row).

# Categories

* [Boolean](function#boolean-functions)

# Examples

<OpalCodeBlock code={
`make_col enabled:bool("yes")
`}/>

Shows `bool` turning a recognized truthy string into true, which is useful for config flags stored as text.

<OpalCodeBlock code={
`make_col has_traffic:bool(bytes_out)
`}/>

Shows `bool` mapping a numeric `int64` to true whenever the count is non-zero, which is a common pattern for presence checks.