Renderingen-US

void

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

Primitive no-value return type.

Aliases: void, unit

Syntax: void

Category#

type

Examples#

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

Primitive no-value return type.

# =============================================================================
# void — Primitive no-value return type.
# =============================================================================
#
# What this teaches:
#   • Void return — `void` for functions that produce no value
#   • Side-effect functions — functions returning `void` execute for their side effects like `print`
#
# Common mistakes:
#   • confusing void (void return type) with empty (empty collection initializer) or none (null singleton)
#
# See also: fn, return
# =============================================================================



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

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

main {
    log("vacuum smoke")
}

Expected output:

vacuum smoke