|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
A statement is sort of a full sentence of instructions, made up from one
or more expressions. Statements usually cover no more than a single line
of code. Sometimes it's necessary to break it up though if it becomes too
long, simply to improve on legibility. For most statements you simply
break the line between two words, but if you are in the middle of a
string you need to add a backslash (
\) at the end of the line
in order for the gamedriver to understand what's going on.
write("This is an example of \ a broken string.\n");
However, breaking a statement with backslash is extremely ugly and makes
the code hard to read. In fact, it's usually possible to break the line
naturally at the end of a string, between two operators of some kind, or
even just split the string in half and add the two parts together with the
+ operator. The only time the backslash really is necessary is in
#define-statements, handled later.
write("This is a better way of " + "breaking a string.\n");
Statements in LPC are usually ended with a
;, which also is a
good place to end the line. There's nothing stopping you from entering
another statement right after, other than that it will look awful.