> For the complete documentation index, see [llms.txt](https://sevenval.gitbook.io/flat/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sevenval.gitbook.io/flat/reference/templating/null-coalescing-operator.md).

# ?? Operator

The null coalescing operator `??` can be used to return default values.

If the expression left of the `??` operator evaluates to `null`, the expression to the right of the operator is evaluated.

The operator can be used in all templating commands that allow expressions, such as [placeholder](/flat/reference/templating/placeholder.md), [if](/flat/reference/templating/if.md), [elseif](/flat/reference/templating/if.md) or [loops](/flat/reference/templating/loop.md).

Input:

```javascript
{}
```

Template:

```javascript
{
    "name": {{ user/name ?? "unkown" }}
}
```

Output:

```javascript
{
  "name": "unknown"
}
```

The `??` operator can be used multiple times in a template expression:

```javascript
{
  "name": {{ user/name ?? user/mail ?? "unknown" }}
}
```

> 📎 Note that `??` operator(s) are used to split the template expression into subexpressions and therefore cannot be used in arguments of functions within those subexpressions.
