var.clear

void clear() @safe

Reset this var to Type.NULL, releasing any held resources.

This method provides an explicit way to clear a var instance, equivalent to assigning var.init but potentially more readable and efficient for reuse scenarios.

After calling clear():

  • type returns Type.NULL
  • toString() returns "null"
  • The instance can be reused for new assignments

Examples

var v = 42;
assert(v.type == var.Type.INT);
v.clear();
assert(v.type == var.Type.NULL);