Glish has a fairly simple rule for when the ; terminating a statement can be left out. In general, if a line ends with a token that suggests continuation (such as a comma or a binary operator). then the statement is continued onto the next line. If it ends with something that could come at the end of a statement, then a semi-colon is inserted. Those tokens that can end a statement are:
) character, unless it's part of the test in a if,
for, or while statement, or the argument list in a
function definition;
] character;
Glish inserts ;'s only at the end of a line or just before a `` {". You can't use its rules to jam two statements onto one line:
print a b := 3is illegal, though both
print a; b := 3and
{ print a } b := 3
are perfectly okay.
You can prevent Glish from inserting a ; by using an escape (\)
as the last character on the line. For example,
print a \
, b
is okay, and equivalent to
print a,
b
or
print a, bSuch a final
\ doesn't work coming after a comment, though:
print a # oops, syntax error next line \
, b
is interpreted as two separate statements, the second one producing
a syntax error.