In general, a line ends when FMSLogo encounters a newline character, a carriage return character followed by a newline character, or the end of the stream.
A line (an instruction line or one read by READLIST or READWORD) can be continued onto the following line if the character immediately before the line break is a tilde (~
).
READWORD preserves the tilde and the newline; READLIST does not.
A tilde which appears anywhere else in a line has no special meaning.
A semicolon begins a comment in an instruction line.
Logo ignores characters from the semicolon to the end of the line.
A tilde (~
) as the last character in the line still indicates a continuation line, but not a continuation of the comment.
Example:
PRINT "abc;comment ~
def
abcdef
There are some special delimiters which continue a line until a matching character is found without the need for a line continuation tilde.
An open bracket "[" continues a line until a matching close bracket "]" is found.
An open parenthesis "(" continues a line until a matching close parenthesis ")" is found.
An open brace "{" continues a line until a matching close brace "}" is found.
A vertical bar "|" continues a token until an unescaped vertical bar is found.