## `envBool`

### Signature

```solidity
function envBool(string calldata key) external returns (bool value);
function envBool(string calldata key, string calldata delimiter) external returns (bool[] memory values);
```

### Description

Reads an environment variable as `bool` or `bool[]`.

### Parameters

| Parameter   | Type     | Description                               |
|-------------|----------|-------------------------------------------|
| `key`       | `string` | The environment variable name             |
| `delimiter` | `string` | The delimiter used to separate array values (optional) |

### Returns

| Type     | Description                                      |
|----------|--------------------------------------------------|
| `bool`   | The environment variable value as a boolean      |
| `bool[]` | The environment variable value as a boolean array |

### Examples

#### Single Value

With environment variable `BOOL_VALUE=true`:

```solidity [test/EnvBool.t.sol]
string memory key = "BOOL_VALUE";
bool expected = true;
bool output = vm.envBool(key);
assert(output == expected);
```

#### Array

With environment variable `BOOL_VALUES=true,false,True,False`:

```solidity [test/EnvBool.t.sol]
string memory key = "BOOL_VALUES";
string memory delimiter = ",";
bool[4] memory expected = [true, false, true, false];
bool[] memory output = vm.envBool(key, delimiter);
assert(keccak256(abi.encodePacked((output))) == keccak256(abi.encodePacked((expected))));
```

### Gotchas

:::note
For `true`, use either "true" or "True" for the environment variable value. For `false`, use either "false" or "False".
:::

### Related Cheatcodes

* [`envOr`](/reference/cheatcodes/env-or) - Read environment variables with default values
* [`envUint`](/reference/cheatcodes/env-uint) - Read environment variables as uint
* [`envString`](/reference/cheatcodes/env-string) - Read environment variables as string
