渲染zh-Hans

无值

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

Primitive no-value return type.

Aliases: void, unit

Syntax: 无值

Category#

type

Examples#

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

Primitive no-value return type.

# =============================================================================
# 无值 — Primitive no-value return type.
# =============================================================================
#
# What this teaches:
#   • Void return — `无值` for functions that produce no value
#   • Side-effect functions — functions returning `无值` execute for their side effects like `显示`
#
# Common mistakes:
#   • confusing 无值 (void return type) with 空集 (empty collection initializer) or 空类型 (null singleton)
#
# See also: 函数, 返回
# =============================================================================



# 无值 — void return type
#
# GRAMMAR:
#   returnType :← '无值'
#
# EXPECTED OUTPUT:
#   Scalar stdout smoke (see body).
#

fn log(string message) → void {
    print message
}

main {
    log("vacuum smoke")
}

Expected output:

vacuum smoke