Void Type - void
The void
type represents a value that is nothing and may only be void
or
undefined
.
This is usually used for functions to hint they have no return. Otherwise, this data type is
practically useless, as it is practically only a synonym for
undefined
.
The only difference is that void
is indicating that the value is always nothing, while
undefined
is indicating that the value is nothing at the moment but may be something
later (Like in an optional parameter or a variable that is not yet assigned).
This also means comparing void
to undefined
will always be true:
Note that unlike in JavaScript, void
is not an operator, but a type. This means that
standard syntax of void 0
is not valid in this language. Instead, simply use void.
Note
This may change in the future, as a way to allow the easy nullification of data using the
void EXP
syntax.