# TO_BOOLEAN

Converts an input value to a boolean value. A string value of `true` will be case-insensitively converted to the Boolean `true`. For anything else, including the empty string, the function will return `false`. The numerical value of `0` will be converted to `false`, and anything else will be converted to `true`.

## Syntax

`TO_BOOLEAN(field)`

### Parameters

#### `field`

The input value to be converted. This can be a single- or multi-valued column or an expression.

## Examples

```esql
ROW str = ["true", "TRuE", "false", "", "yes", "1"]
| EVAL bool = TO_BOOLEAN(str)
```

This example converts a multi-valued string column into boolean values. For instance:
- `"true"` and `"TRuE"` are converted to `true`.
- `"false"`, `""` (empty string), and other non-`true` strings are converted to `false`.
- `"1"` is converted to `true`.

```esql
ROW num = [0, 1, 2, -1]
| EVAL bool = TO_BOOLEAN(num)
```

## Notes

- A string value of `true` is case-insensitively converted to the boolean `true`. For any other value, including an empty string, the function returns `false`.
- A numerical value of `0` is converted to `false`, while any other numerical value is converted to `true`.
