Formatting Executable Statements
- Last UpdatedJul 18, 2023
- 2 minute read
The following conventions should be observed when formatting executable statements:
-
Statements are placed on new lines, indented one tab stop from the level of their surrounding block.
Note: Do not place more than one statement on a single line. While this practice is permitted in other programming languages, in Cicode the subsequent statements will not be interpreted and will effectively be lost, potentially affecting your program's runtime behavior.
|
|
|
UNINTENDED EQUIPMENT OPERATION Do not place more than one statement per line. Failure to follow these instructions can result in death, serious injury, or equipment damage. |
Although it may be argued that some statements are logically related, this is not sufficient justification. If they are logically related, place the statements on consecutive lines and separate the statements by a blank line before and after. For example:
hFile = -1; hForm = -1; // WRONG
hFile = -1; // RIGHT
hForm = -1; // RIGHT
IF statements can be used in one of the formats below. When indenting the IF statements, a tab stop should be used. For example:
-
Simple IF block
IF <expression> THEN
...
END -
IF-THEN-ELSE block
IF <expression> THEN
...
ELSE
...
END -
To simulate ELSEIF blocks, use nested statements. For example:
IF <expression> THEN
...
ELSE
IF <expression> THEN
...
ELSE
IF <expression> THEN
...
ELSE
...
END
END
END
-
For WHILE and FOR statements see Working with Conditional Executors.
See Also
Using Cicode Commands
