---
source: crates/tinymist-query/src/hover.rs
expression: content
input_file: crates/tinymist-query/src/fixtures/hover/cases_doc.typ
---
Range: 0:20:0:25

```typc
let cases(
  ..children: content,
  delim: array | none | str | symbol = ("{", "}"),
  gap: relative = 0% + 0.2em,
  reverse: bool = false,
);
```


======


A case distinction.

Content across different branches can be aligned with the `&` symbol.

## Example

```typ
$ f(x, y) := cases(
  1 "if" (x dot y)/2 <= 0,
  2 "if" x "is even",
  3 "if" x in NN,
  4 "else",
) $
```

# Rest Parameters

## children

```typc
type: content
```

The branches of the case distinction.

# Named Parameters

## delim

```typc
type: array | none | str | symbol
```

The delimiter to use.

Can be a single character specifying the left delimiter, in which case the right delimiter is inferred. Otherwise, can be an array containing a left and a right delimiter.

```typ
#set math.cases(delim: "[")
$ x = cases(1, 2) $
```

## gap (named)

```typc
type: relative
```

The gap between branches.

```typ
#set math.cases(gap: 1em)
$ x = cases(1, 2) $
```

## reverse (named)

```typc
type: bool
```

Whether the direction of cases should be reversed.

```typ
#set math.cases(reverse: true)
$ cases(1, 2) = x $
```


======


[Open docs](https://typst.app/docs/reference/math/cases/)
