CodeBlock
A codeblock is
code within a set of brackets; also known as simply a
block.
Example:
default { // Start default's code block.
} // End default's code block.
Of course, code block statements can contain other code blocks.
Example:
default { // Start default's code block.
state_entry() { // Start the state_entry event block
} // End the state_entry event block
} // End default's code block.
Some prefer to place the 'opening brace' of the code block on the next following row.
for(iterator declaration; condition; increment operation)
{ // Start loop code block.
} // End loop code block.
Where to place that opening brace is a topic for religious fervor. See
braces for more on this.
Usually, you
indent the statements of the code block, that is, add spaces or tab-spaces to make an outline of the code - this highly improves readability.
if(someCondition)
{ // Start conditional code block.
// Tabulated inner statement
for(iterator declaration; condition; increment operation)
{
// Tabulated inner inner et.c.
}
} // End conditional code block.
Glossary |
Script |
Brace