next up previous contents index
Next: Functions Up: Statements Previous: Sending and Receiving Events

Leaving Out the Statement Terminator

 

    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:

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 := 3
is illegal, though both
    print a; b := 3
and
    { 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, b
Such 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.    

 



Thu Nov 13 16:44:05 EST 1997