Kết xuấtvi

viết

Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.

Writes a value to standard output.

Syntax: viết <expression>

Category#

output

Examples#

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

Writes a value to standard output.

# =============================================================================
# viết — Writes a value to standard output.
# =============================================================================
#
# What this teaches:
#   • Standard output — `viết` sends values to stdout, the primary output channel.
#   • Expression evaluation — Any expression can be passed, including variables and literals.
#
# Common mistakes:
#   • Confusing viết (stdout without trailing newline) with ghi_chú (diagnostic output with trailing newline).
#
# See also: xem, cảnh_báo
# =============================================================================

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

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

    # Variable output
    const string tên ← "Marcus"
    print tên

    # Multiple arguments
    const int aetas ← 30
    print "nomen: §"(tên)
    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