Kết xuấtvi

rỗng

Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.

Represents the null value and can prefix a null check.

Syntax: rỗng_ty [<expression>]

Category#

literal

Examples#

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

Null literal and nullable union bindings.

# =============================================================================
# rỗng_ty — Null literal and nullable union bindings.
# =============================================================================
#
# What this teaches:
#   • the `rỗng_ty` literal — represents absence of a value (null)
#   • nullable union types with `∪` — `T ∪ rỗng_ty` for values that may be absent
#   • null checks with `est rỗng_ty` and `không est rỗng_ty`
#
# Common mistakes:
#   • Using rỗng_ty without declaring the type as T ∪ rỗng_ty — rỗng_ty requires a nullable union type.
#
# See also: ∪, tự_nguyện, rỗng_ty
# =============================================================================

# literalia/nihil — rỗng_ty literal and T ∪ rỗng_ty
#
# GRAMMAR:
#   literal :← 'rỗng_ty'
#   unionType :← type '∪' 'rỗng_ty'
#
# EXPECTED OUTPUT:
#   rỗng_ty, đúng, 42
#
# BACKEND:
#   Cross-ref rỗng_ty/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.

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

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

main {
    const none nothing ← null
    print nothing
}

Expected output:

nihil