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.

write

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

Writes a value to standard output.

Syntax: write <expression>

Category#

console

Examples#

radix/corpus/reference/keyword/scribe/nota.fab (canonical · keyword)#

Writes a value to standard output.

# =============================================================================
# write — Writes a value to standard output.
# =============================================================================
#
# What this teaches:
#   • Standard output — `write` sends values to stdout, the primary output channel.
#   • Expression evaluation — Any expression can be passed, including variables and literals.
#
# Common mistakes:
#   • Confusing write (stdout without trailing newline) with print (diagnostic output with trailing newline).
#
# See also: debug, warn
# =============================================================================

# print — diagnostic output statements
#
# print literal-textus
# print expr
# print template with § interpolation
# print labeled template with multiple § placeholders
#
# GRAMMAR:
#   outputStmt :← 'print' expr (',' expr)*
#
# EXPECTED OUTPUT:
#   nota.expected — greeting, variable, formatted strings, sum, coordinates.

main {
    # Simple string output
    print "Salve, Munde!"

    # Variable output
    let string name ← "Marcus"
    print name

    # Multiple arguments
    let int aetas ← 30
    print "nomen: §"(name)
    print "aetas: §"(aetas)

    # Expressions
    let int x ← 10
    let int y ← 20
    print "summa: §"(x + y)

    # Multiple values in one statement
    print "coordinata: § §"(x, y)
}

Expected output:

Salve, Munde!
Marcus
nomen: Marcus
aetas: 30
summa: 30
coordinata: 10 20