colobot-data/help/cbot/E/term.txt

32 lines
845 B
Plaintext

\b;Semicolon
Always use a semicolon \c;;\n; after a simple expression. For example:
\c;
\s; int counter = 0;
\n;
However, after a \l;bloc\u cbot\bloc;, never put a semicolon:
\c;
\s; {
\s; float dist;
\s; dist = distance(p1, p2);
\s; } \n;// no semicolon here!\c;
\n;
Do not use a semicolon either immediately after the instructions \c;\l;while\u cbot\while;\n;, \c;\l;if\u cbot\if;\n; or \c;\l;for\u cbot\for;\n;:
\c;
\s; if ( a < b ) \n;// no semicolon here!\c;
\s; {
\s; b = 100-a;
\s; }
\n;
An instruction is always ended by a semicolon, and not by the end of the line. So you can very well put several instructions on the same line:
\c;
\s; int d=20;
\s; move(d);
\s; turn(90);
\n;
Is equivalent to:
\c;
\s; int d=20; move(d); turn(90);
\n;
\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.