Skip to content

Null

Null is one shared object that means “there is nothing here” (NSNull in shape). A collection stores Object*, and a null reference usually means absent. Sometimes a slot needs an explicit nothing that is still an object: a sparse row, a JSON null, a cleared entry that must keep its place. From 0.72.

#import "Null.xc" // or the Foundation umbrella
Array* row = new Array();
row.add(Null.null()); // a gap that keeps its index
if (Null.isNothing(row.get((u32)0))) // a null reference or Null.null()
…

There is only ever one instance, so compare with isNull or by reference. Its description is null. JSON reads null as this object.

· null · isNull · isNothing · description


static Null* null(void)

The shared instance.

static bool isNull(Object* o)

Whether o is the shared instance. A null reference is not.

static bool isNothing(Object* o)

Whether o is a null reference or the shared instance.

String* description(void)

null.

↑ Topics