Skip to content

Null#

The null value represents the absence of a value.

Literal#

The null literal corresponds to JSON null and google.protobuf.NullValue.

null
// result: null (null_type)

Comparison#

Null can only be compared to null.

null == null
// result: true (bool)
null != null
// result: false (bool)

Comparing null to other types produces a compile error.

1 == null
// error: found no matching overload for '_==_' applied to '(int, null)'
"" == null
// error: found no matching overload for '_==_' applied to '(string, null)'

See also#