When you look into the 'Void', only 'null' can be seen.

Is there anybody out there?

An entry is evaluated to null if not defined on current scope.

You can compare with null using equality == or inequality !=, like:

a == null  # true, if 'a' is not defined
0 != null  # true, because 0 is a defined value

Keep in mind that you can't declare an entry with no value in FatScript.

While you can assign null to an entry, it causes different behaviors depending on whether the entry already exists in the scope and whether it's mutable or not:

  • If an entry hasn't been declared yet, assigning it null has no effect.
  • If it already exists and is immutable, assigning null raises an error.
  • If it already exists and is mutable, assigning null removes the entry.

Delete statement

Assigning null to a mutable entry is the same as deleting that entry from the scope. If deleted, nothing is remembered about that entry in the scope, not even it's original type.

~ m = 4   # mutable number entry
m = null  # deletes m from scope

null "values" are always mutable, as in fact nothing is stored about them, and therefore they are the only kind of "value" that may transition from a mutable state to an immutable state when "reassigned"


You can use Void to check against the value of an entry also, like:

()    == Void  # true
null  == Void  # true
false == Void  # false
0     == Void  # false
''    == Void  # false
[]    == Void  # false
{}    == Void  # false

Note that Void only accepts null.

Another form of emptiness

Nulls can also be expressed as empty parentheses () and are effectively identical, in terms of behavior in code:

null  == null  # true
()    == null  # true
()    == ()    # true

See also

results matching ""

    No results matching ""