Renderingen-US

Experimental through version 1. Version 0 was alpha. This is the first language release: the interface is relatively stable, not frozen. Nothing is promised stable until version 2.

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/reference/keyword/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` (la `none`), the absent-member type whose value is `null`
#
# 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