渲染zh-Hant

寫出

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

Writes a value to standard output.

Syntax: 寫出 <expression>

Category#

output

Examples#

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

Writes a value to standard output.

# =============================================================================
# 寫出 — Writes a value to standard output.
# =============================================================================
#
# What this teaches:
#   • Standard output — `寫出` sends values to stdout, the primary output channel.
#   • Expression evaluation — Any expression can be passed, including variables and literals.
#
# Common mistakes:
#   • Confusing 寫出 (stdout without trailing newline) with 註記 (diagnostic output with trailing newline).
#
# See also: 檢視, 警告
# =============================================================================

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

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

    # Variable output
    const string 名稱 ← "Marcus"
    print 名稱

    # Multiple arguments
    const int aetas ← 30
    print "nomen: §"(名稱)
    print "aetas: §"(aetas)

    # Expressions
    const int x ← 10
    const 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