In macros, there are many structures which involve blocks of code framed by delimiting keywords at the beginning and end of the block. One example is the if-else-endif branching structure (other examples are the while, for and switch structures).
if
// do something
else
// do something else
endif
There are 2 potential sources of errors stemming from blocks of code :
•Incorrectly placed closing keywords can put instructions in the wrong block. Misleading indentation can make this difficult to notice, even when the macro compiles successfully.
•Missing closing keywords will generate a compilation error.
To prevent both types of errors, we suggest that you always write the entire skeleton of a block before writing the code inside. For example, in the case of an if-else-endif block you would follow the sequence:

In the above sequence, all you need to do is type if then press RETURN twice then write else then press RETURN twice then write endif. The automated indentation of the macros editor ensures that each of the keywords is indented properly so that your code reads as it is processed.
See also: Contextual Highlighting, Using Pseudo Code, Smart Tabulations, Code Completion, Contextual Help.
Topic 172160, last updated on 17-Oct-2026