Sort Null Values

A NULL value is defined as the smallest value for its corresponding data type. Therefore, when sorting in an ascending order, NULL values always rank first.

$ x = 1 2 NULL NULL 3;
$ x;
[1,2,,,3]

$ sort!(x);
[,,1,2,3]
// sort x in an ascending order with NULL values on the top

$ sort!(x,false);
[3,2,1,,]
// sort x in a descending order with NULL values on the bottom

A negative infinity (-inf) value imported from external source or generated by calculations is smaller than NULL.

// use the float function to create a negative inf and compare it with NULL
$ -float("inf")<NULL
true