

# nullIf


`nullIf` compares two expressions. If they are equal, the function returns null. If they are not equal, the function returns the first expression.

## Syntax


```
nullIf(expression1, expression2)
```

## Arguments


`nullIf` takes two expressions as arguments. 

 *expression*   
The expression can be numeric, datetime, or string. It can be a field name, a literal value, or another function. 

## Return type


String

## Example


The following example returns nulls if the reason for a shipment delay is unknown.

```
nullIf(delayReason, 'unknown')
```

The following are the given field values.

```
delayReason
============
unknown         
back ordered 
weather delay
```

For these field values, the following values are returned.

```
(null)
back ordered 
weather delay
```