ifNull

Syntax

ifNull(X, Y)

Arguments

X is a scalar/pair/vector/matrix.

Y is a scalar/pair/vector/matrix.

X and Y must have the same data type.

Details

Determine whether X is NULL. If it is NULL, return X, if not, return Y.

Examples

$ x = take(1..5 join NULL 6,7)
$ y = 1..7
$ ifNull(x,y)
[1,2,3,4,5,,7]
$ y1 = int(take(1..5 join int(),6))$2:3
$ x1 = int(take(100,6))$2:3
$ ifNull(x1,y1)

col1

col2

col3

100

100

100

100

100

If X is a vector and Y is a matrix with n rows and m columns, the length of X is n*m.

$ m=int(take(1..4 join NULL 8,6))
$ ifNull(m,y1)
[100,100,100,100,,100]