Next: Execution Chance, Previous: Line Labels, Up: Syntax [Index]
INTERCAL-72 | C-INTERCAL | CLC-INTERCAL | J-INTERCAL |
---|---|---|---|
yes | all versions | all versions | all versions |
After the line label (if a statement has one) comes the statement identifier, which marks where the statement starts. Either the label or the statement identifier, whichever one comes first, marks where the preceding statement finishes.
The main statement identifier is DO
. It also has two
synonyms, PLEASE
and PLEASE DO
; these
synonyms are the ’polite’ forms of statement identifiers.
Although the three identifiers have the same meaning, using either
polite or non-polite identifiers too much can cause an error; the
correct proportion is approximately 3 non-polite identifiers for every
polite identifier used. None of these identifiers actually does
anything else apart from marking where the statement starts; they leave
the statements in the default ‘reinstated’ state.
Adding NOT
or N'T
to the end of any of these
identifiers, to create a statement identifier such as DO
NOT
or PLEASE DON'T
, also creates a valid statement
identifier. These differ in meanings from the previous set of
identifiers, though; they cause the statement they precede to not be
executed by default; that is, the command will be skipped during
execution (this is known as the ‘abstained’ state). This
applies even if the command in question is in fact a syntax error, thus
causing this to be a useful method of writing comments. One common
idiom is to write code like this:
PLEASE NOTE: This is a comment.
The statement identifier (PLEASE NOT
) is the only part of
this statement that is valid INTERCAL; however,
because the statement identifier is in the negated form that contains
NOT
, the syntax error won’t be executed, and
therefore this is a valid statement. (In INTERCAL,
syntax errors happen at runtime, so a program containing a statement
like DOUBT THIS WILL WORK
will still compile, and will not
end due to the syntax error unless that statement is actually executed.
See E000.)
The ABSTAIN
and REINSTATE
statements can
override the NOT
or otherwise on a statement identifier;
see ABSTAIN.
In backtracking programs, MAYBE
is also a valid statement
identifier; see MAYBE. It comes before
the other keywords in the statement identifier, and an implicit
DO
is added if there wasn’t one already in the
statement identifier (so MAYBE
, MAYBE DO
,
MAYBE DON'T
, MAYBE PLEASE
, and so on are all
valid statement identifiers).
Next: Execution Chance, Previous: Line Labels, Up: Syntax [Index]