渲染zh-Hans

布尔

Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans pack; supporting prose may still be English.

Primitive types 布尔, 无值, and 未知.

Syntax: 布尔 | 无值 | 未知

Category#

type

Examples#

radix/corpus/intrinseca/primitiva.fab (canonical · keyword)#

Primitive types 布尔, 无值, and 未知.

# =============================================================================
# 布尔 — Primitive types 布尔, 无值, and 未知
# =============================================================================
#
# What this teaches:
#   • Primitive types 布尔, 无值, and 未知.
#   • Related keywords: 真, 假, 函数, ∷, 无值
#
# Common mistakes:
#   • Using `未知` where a concrete type is expected — `未知` is the dynamic dispatch type; use `是` checks or match before extracting.
#
# See also: 真, 假, 函数, ∷, 无值
# =============================================================================

# intrinseca/primitiva — 布尔, 无值, 未知
#
# GRAMMAR:
#   typeExpr :← '布尔' | '无值' | '未知'
#
# EXPECTED OUTPUT:
#   ping, 空类型 est, 真 est, aliud est
#
# BACKEND:
#   Cross-ref 无值/vacuum.fab for void returns; 整数/fractus/textus intrinseca files.

fn ping() → void {
    print "primitiva smoke"
}

fn describe(any value) → string {
    if value is none then return "nihil est"
    return "aliud est"
}

fn describe_boolean(bool value) → string {
    if value ≡ true then return "verum est"
    return "aliud est"
}

main {
    ping()
    print describe(null)
    print describe_boolean(true)
    print describe(42)
}

Expected output:

primitiva smoke
nihil est
verum est
aliud est