Renderingen-US

Experimental through version 1. Version 0 was alpha. This is the first language release: the interface is relatively stable, not frozen. Nothing is promised stable until version 2.

none

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

Represents the null value and can prefix a null check.

Syntax: none [<expression>]

Category#

literal

Examples#

radix/corpus/literalia/nihil.fab (canonical · keyword)#

Null literal and nullable union bindings.

# =============================================================================
# none — Null literal and nullable union bindings.
# =============================================================================
#
# What this teaches:
#   • the `none` literal — represents absence of a value (null)
#   • nullable union types with `∪` — `T ∪ none` for values that may be absent
#   • null checks with `est none` and `is not none`
#
# Common mistakes:
#   • Using none without declaring the type as T ∪ none — none requires a nullable union type.
#
# See also: ∪, optional, none
# =============================================================================

# literalia/nihil — none literal and T ∪ none
#
# GRAMMAR:
#   literal :← 'none'
#   unionType :← type '∪' 'none'
#
# EXPECTED OUTPUT:
#   none, true, 42
#
# BACKEND:
#   Cross-ref none/nihil.fab.

fn maybe() → int ∪ none {
    return 42
}

main {
    let int ∪ none absent ← null
    print absent
    let bool nihilne ← absent is none
    print nihilne
    print maybe() not is none
}

Expected output:

none
true
true

radix/corpus/nihil/nihil.fab (canonical · keyword)#

Represents the null value and can prefix a null check.

# =============================================================================
# none — Represents the null value and can prefix a null check.
# =============================================================================
#
# What this teaches:
#   • the `none` keyword — used for null/none values
#
# Common mistakes:
#   • Using none without ∪ in the type position — nullable types must be declared as T ∪ none.
#
# See also: ∪, optional
# =============================================================================

# none — null literal
#
# GRAMMAR:
#   literal :← 'none'
#
# EXPECTED OUTPUT:
#   Scalar stdout smoke (see body).
#

main {
    let none nothing ← null
    print nothing
}

Expected output:

none