> ## Documentation Index
> Fetch the complete documentation index at: https://errand.nuvrel.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# tobool

> Convert a value to a boolean.

`tobool(v)` converts `v` to a boolean. The string `"true"` becomes `true`, and `"false"` becomes `false`. Boolean values pass through unchanged.

## Signature

```
tobool(v any) bool
```

## Example

Read a feature flag from the environment as a string and use it as a boolean condition:

```hcl theme={null}
computed "run_migrations" {
  description = "Whether to run database migrations in this deploy"
  expression  = tobool(env("RUN_MIGRATIONS", "true"))
}

task "migrate" {
  description = "Run database migrations"
  condition   = computed.run_migrations
  commands    = ["./bin/migrate up"]
}

task "deploy" {
  description = "Deploy the application"
  depends_on  = [task.migrate]
  commands    = ["kubectl rollout restart deployment/app"]
}
```

Setting `RUN_MIGRATIONS=false` in the environment skips the migration task.

## Notes

* Only the strings `"true"` and `"false"` are valid inputs. Any other string causes an error.
* `tobool` is most useful when a value comes from an environment variable or CLI flag that is inherently a string.
