# nullish() Function & Examples

Use the nullish() logical function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## nullish

#### x ?? y

#### nullish(x, y)

Try it yourself:

```calculio
null ?? 42
undefined ?? 42
0 ?? 42
false ?? 42
null ?? undefined ?? 42
```

[and](https://calcul.io/function/and/index.md)

[or](https://calcul.io/function/or/index.md)

[not](https://calcul.io/function/not/index.md)

---

## nullish(): provide a fallback for missing values

**nullish(a, b)** returns a when it is present and otherwise returns b. It is useful when a calculation accepts optional settings, data fields, or defaults.

## Missing is not zero

Nullish behavior is deliberately different from ordinary Boolean fallback: zero, false, and an empty string can be meaningful values and should normally remain intact. Use it to supply a default only for null-like absence.

## Practical use

Pair nullish() with [isNumeric()](https://calcul.io/function/isNumeric/index.md) when a default must still be numeric, [format()](https://calcul.io/function/format/index.md) for display, and [equal](https://calcul.io/function/equal/index.md) for a fuller branch. Use [isZero()](https://calcul.io/function/isZero/index.md) if zero needs special treatment.

## Caveat

Decide whether absent, empty, and invalid inputs mean different things in your model before applying one fallback rule.

[All functions](https://calcul.io/functions/index.md)
