การเรนเดอร์th-TH

ว่าง

Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.

Represents the null value and can prefix a null check.

Syntax: นัล [<expression>]

Category#

literal

Examples#

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

Null literal and nullable union bindings.

# =============================================================================
# นัล — Null literal and nullable union bindings.
# =============================================================================
#
# What this teaches:
#   • the `นัล` literal — represents absence of a value (null)
#   • nullable union types with `∪` — `T ∪ นัล` for values that may be absent
#   • null checks with `est นัล` and `ไม่ est นัล`
#
# Common mistakes:
#   • Using นัล without declaring the type as T ∪ นัล — นัล requires a nullable union type.
#
# See also: ∪, สมัครใจ, นัล
# =============================================================================

# literalia/nihil — นัล literal and T ∪ นัล
#
# GRAMMAR:
#   literal :← 'นัล'
#   unionType :← type '∪' 'นัล'
#
# EXPECTED OUTPUT:
#   นัล, จริง, 42
#
# BACKEND:
#   Cross-ref นัล/nihil.fab.

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

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

Expected output:

nihil
verum
verum

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

Represents the null value and can prefix a null check.

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

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

main {
    const none nothing ← null
    print nothing
}

Expected output:

nihil