none
Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.
The absent-member type: none (la none) is the type, null (la null) is its value.
Syntax: T ∪ none | null
Category#
logic
Related#
Examples#
radix/corpus/reference/type/nihil/nihil.fab (canonical · type)#
The absent-member type: none (la none) is the type, null (la null) is its value.
# =============================================================================
# none — The absent-member type: none (la none) is the type, null (la null) is its value.
# =============================================================================
#
# What this teaches:
# • the type — `none` (la `none`) is the absent member of a nullable union `T ∪ none` (la `T ∪ none`)
# • the value — `null` (la `null`) is the null value; `none` is never a value (SEM001 name_not_value)
# • the check — `x is none` (la `est none`) tests the none type; `is` with the `null` value literal is refused (PARSE040 est_value_literal_names_equality)
#
# Common mistakes:
# • Putting the null value literal in a type position — PARSE040 null_value_in_type_position; the nullable union is `T ∪ none`.
#
# See also: ∪, optional
# =============================================================================
# none — the none type and the null value
#
# GRAMMAR:
# literal :← 'null'
#
# EXPECTED OUTPUT:
# Scalar stdout smoke (see body).
#
main {
let none nothing ← null
print nothing
}Expected output:
none