string
Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.
Short quoted 文字 string literals and template application.
Aliases: \"...\"
Syntax: \"<text>\"
Category#
literal
Related#
Examples#
radix/corpus/literalia/textus.fab (canonical · existing-home)#
Short quoted 文字 string literals and template application.
# =============================================================================
# string — Short quoted 文字 string literals and template application.
# =============================================================================
#
# What this teaches:
# • double-quoted string literals `"..."` — the standard 文字 syntax
# • template application with `§` placeholders — `"Salve, §!"(名稱)`
#
# Common mistakes:
# • Applying template § to ascii or 位元組 literals — template application works only on 文字 ("...") string literals.
#
# See also: block-string, §, 文字
# =============================================================================
# literalia/textus — "..." string literals
#
# GRAMMAR:
# stringLit :← '"' ... '"'
# templateApp :← stringLit '(' expr (',' expr)* ')'
#
# EXPECTED OUTPUT:
# Salve, Salve, Mundus!
main {
const string greeting ← "Salve"
print greeting
const string 名稱 ← "Mundus"
const string message ← "Salve, §!"(名稱)
print message
}Expected output:
Salve
Salve, Mundus!