← index

Nilsealed

inherits Object

The class of nil, the single 'no value' value -- what a missing Map key or a search that finds nothing returns. nil is not a Boolean and does not answer if:else:; test for it with == nil or defined? (which is false only for nil).

nil == nil       "* -> true
nil.defined?     "* -> false
extended at core/00-bootstrap.qn:331

nil's overrides: falsy, prints as nothing, and absorbs arithmetic.

Class methods

default

nil — the type's only value.

core/00-bootstrap.qn:334

Instance methods

!

nil is falsy: !nil is true.

core/00-bootstrap.qn:343

%:

nil % x is nil (see +:).

core/00-bootstrap.qn:355

*:

nil * x is nil (see +:).

core/00-bootstrap.qn:351

+:

Arithmetic on nil absorbs: nil + x is nil, so a missing value propagates through a calculation instead of erroring.

core/00-bootstrap.qn:347

-:

nil - x is nil (see +:).

core/00-bootstrap.qn:349

/:

nil / x is nil (see +:).

core/00-bootstrap.qn:353

==:

Whether the argument is also nil -- nil equals only itself.

nil == 5     "* -> false

native

defined?

false — nil (and only nil) is undefined.

core/00-bootstrap.qn:340

s

The empty string: nil renders as nothing.

core/00-bootstrap.qn:338