Within square brackets, words are delimited only by spaces and square brackets.
[2+3] is a list containing one word.
A word not after a quotation mark or inside square brackets is delimited by a space, a bracket, a parenthesis, or an infix operator
Words that follow colons are also in this category.
Note that quote and colon are not delimiters.
A word consisting of a question mark followed by a number (e.g.,
?3), is parsed as if it were the sequence
making the number an input to the
(See the section on Template-Based Iteration).
This special treatment does not apply to words read as data, to words with a non-number following the question mark, or if the question mark is backslashed.
A line (an instruction line or one read by READLIST or READWORD) can be continued onto the following line if its last character 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.
print "abc;comment ~ defabcdef
To include an otherwise delimiting character (including semicolon or tilde) in a word, precede it with backslash (
If the last character of a line is a backslash, then the newline character following the backslash is part of the last word on the line, and the line continues onto the following line.
To include a backslash in a word, use
All of this applies to data lines read with READLIST or READWORD as well as to instruction lines.
In FMSLogo there is no "prompt character" nor is the carriage return passed from the input control box of the commander. However, FMSLogo does add the linefeed control character which translates to a carriage return.
print "Hello\nhow\nare\nyouHello how are you
This works in a procedure or from the input control box.
A character entered with backslash is EQUALP to the same character without the backslash, but can be distinguished by the BACKSLASHEDP predicate. Backslashing is effective only on characters for which it is necessary: whitespace, parentheses, brackets, infix operators, backslash, vertical bar, tilde, quote, question mark, colon, and semicolon.
An alternative notation to include otherwise delimiting characters in words is to enclose a group of characters in vertical bars (
All characters between vertical bars are treated as if they were letters.
In data read with READWORD the vertical bars are preserved in the resulting word.
In data read with READLIST (or resulting from a PARSE or RUNPARSE of a word) the vertical bars do not appear explicitly; all potentially delimiting characters (including spaces, brackets, parentheses, and infix operators) appear as though entered with a backslash.
Within vertical bars, backslash may still be used; the only characters that must be backslashed in this context are backslash and vertical bar themselves.
Characters entered between vertical bars are forever special, even if the word or list containing them is later reparsed with PARSE or RUNPARSE. The same is true of a character typed after a backslash, except that when a quoted word containing a backslashed character is runparsed, the backslashed character loses its special quality and acts thereafter as if typed normally. This distinction is important only if you are building a Logo expression out of parts, to be RUN later, and want to use parentheses. For example,
PRINT RUN (SENTENCE "\( 2 "+ 3 "\))
prints 5, but
RUN (SENTENCE "MAKE ""|(| 2)
creates a variable whose name is open-parenthesis. (Each example would fail if vertical bars and backslashes were interchanged.)