Line Breaks and Statements
Normally, statements are separated by line breaks. If you want to put more than one statement on the same line, you can separate them by semicolons instead:
draw centered(text("Hello!")); draw centered(text("World!"))
Since line breaks separate statements, trying to wrap a single statement across multiple lines doesn't work.
// Doesn't work! var x = 1 + 2
Inside parentheses (), however, line breaks are treated like normal whitespace. If you're wrapping something across multiple lines, make sure to use parentheses:
var x = (1 + 2)
If you're already inside a pair of parentheses, you don't need to add another:
draw centered( text("Hello!") )
You can put line breaks inside records:
{ x: 2, y: 7 }
arrays:
[ 1, 2, 3 ]
and array lookups:
var a = [1, 2, 3] a[0 + 1]
Line breaks are also considered whitespace during string interpolation:
"adding up numbers: \( 1 + 2 + 3 )"