Use this page to choose names and literal spellings, and to split an expression across lines. You will see when a newline ends a statement and when the expression continues.
Run a file with a multiline expression
Install Topaz through First Program, then save this as lexical-layout.tpz.
let ready = true
let archived = false
let missing = null
let 상태 = "ready"
let total =
40 +
2
print("{상태}: {ready}, {archived}, {missing}, {total}")Check and run it from the folder containing the file.
topaz check lexical-layout.tpz
topaz run lexical-layout.tpzThe check succeeds, and the program prints the following text.
ready: true, false, null, 42The first four declarations each fit on one line. The declaration of total spans three lines and produces 42. 상태 is a valid Unicode name. Keywords such as let, true, false, and null keep their English spelling.
Decide where to break a line
The lines ending in = and + need another value, so the total expression continues. Indentation helps you read the code. Delimiters and operators determine how the compiler groups it.
| Task | Write it this way |
|---|---|
| Finish a top-level declaration or block statement | Start the next item on a new line |
| Continue arithmetic or a pipeline | Leave the operator at the end of the previous line |
| Split arguments, collection elements, or record fields | Keep the list inside its delimiters and use commas between entries |
| Make grouping explicit | Add parentheses |
Newlines act as whitespace inside parentheses, brackets, record braces, and parameter or argument lists. Inside a block, match body, or concurrent body, a completed line can end an item.
You can also separate statements with ;. Use commas for list entries. An else on the next line still belongs to its if or timed concurrent expression. No explicit line-continuation character is needed.
Write names, comments, and literals
An identifier is a name such as total or 상태. It starts with a Unicode letter, _, or emoji. Following characters can also include Unicode digits. _internal is an ordinary name. A single _ discards a value in a pattern or marks an argument position in a pipeline. You cannot read it as a variable.
A literal writes a value directly, such as 42, true, null, or "ready".
| Task | Form |
|---|---|
| Comment to the end of a line | // comment |
| Comment across lines | /* comment */, with no nested block comments |
| Write an integer or float | Decimal digits, such as 42 or 1.5 |
| Write text | Double quotes, with escapes such as \n and interpolation such as {total} |
| Write multiline text | Triple quotes |
Exponent notation such as 1e21, alternate number bases, and digit separators such as 1_000 are unsupported. Write decimal digits or compute the value.
For triple-quoted text, every nonblank line must start with the whitespace prefix of closing quotes on a separate line. Strings & Templates explains the indentation rule, the public 5.20.3 interpreter behavior, and Unicode scalar access. Topaz does not normalize strings implicitly.
Correct an unexpected parse
If a calculation stops at a line break, check the position of + or -. At the start of a new statement, these signs can be unary operators applied to one value. Move the operator to the preceding line or enclose the expression in parentheses.
The compiler recognizes the longest valid token. It reads ?. as optional access. To access a member after Result propagation, write (expr?).field. Likewise, ... is distinct from the rest-pattern marker .. and the range operator ..<.
Use double quotes for strings. Single-quoted strings and character literals are unsupported. For text access, replace s[i] or s.length with Array operations on s.scalars(). Direct string slices and grapheme-cluster APIs are unavailable.
Continue with Operators & Expressions for grouping rules, Types for type annotations, or Forbidden & Deferred Forms for other rejected spellings.