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

# boolean module: logical operations in Lion

> Lion's boolean module provides not, and, or, xor, nand, nor, and equals? — a complete set of logic gates for composing conditions in Lion expressions.

The `boolean` module gives you the full set of classical logic gates as Lion functions. All binary operations take exactly two boolean arguments. The unary `not` takes a single boolean. Passing a non-boolean value produces a schema validation error.

## Functions

### `boolean/not`

Negates a boolean value.

```json theme={null}
["boolean/not", true]
```

Result: `false`

***

### `boolean/and`

Returns `true` when both arguments are `true`.

```json theme={null}
["boolean/and", true, false]
```

Result: `false`

***

### `boolean/or`

Returns `true` when at least one argument is `true`.

```json theme={null}
["boolean/or", false, true]
```

Result: `true`

***

### `boolean/xor`

Returns `true` when exactly one argument is `true` (exclusive or).

```json theme={null}
["boolean/xor", true, false]
```

Result: `true`

```json theme={null}
["boolean/xor", true, true]
```

Result: `false`

***

### `boolean/nand`

Returns `false` only when both arguments are `true` (not-and).

```json theme={null}
["boolean/nand", true, true]
```

Result: `false`

```json theme={null}
["boolean/nand", true, false]
```

Result: `true`

***

### `boolean/nor`

Returns `true` only when both arguments are `false` (not-or).

```json theme={null}
["boolean/nor", false, false]
```

Result: `true`

```json theme={null}
["boolean/nor", false, true]
```

Result: `false`

***

### `boolean/equals?`

Returns `true` when both boolean values are identical.

```json theme={null}
["boolean/equals?", true, true]
```

Result: `true`

## Composing boolean logic

Boolean operations nest naturally to express compound conditions:

```json theme={null}
["boolean/and",
  ["number/greaterThan", "age", 18],
  ["boolean/not", "isBanned"]]
```

<Tip>
  Prefer `cond` over deeply nested `boolean/and`/`boolean/or` chains when you have three or more conditions. It is easier to read and adds `else` fallback support.
</Tip>
