Writing Blocks of Code
In the Q++ macro language, 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).
// do something
// do something else
There are 2 potential sources of errors stemming from blocks of code :
•Missing keywords at the end of the macro 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.