---
updatedAt: 2025-12-05T18:41:41.000Z
agentTools:
  projectIndex: https://docs.observeinc.com/llms.txt
---

# if_null

Aliases: `ifnull` (deprecated).

```
if_null(arg: storable, replacement: arg) -> arg
```

Return the second argument if the first argument has the null value. Arguments must have the same type.

# Domain

This is a scalar function (calculates a single output value for a single input row).

# Categories

* [Misc](function#misc-functions)

# Examples

<OpalCodeBlock code={
`make_col foo:if_null(foo, 0)
`}/>

Replace the value of column 'foo' with the value 0 if the value is null.