Most for statements start with “for (var x = 0;…),” where x is a variable identifier that is used within the for loop. If for loops are nested, the variable identifier must be unique for each loop inside another loop.
The for macro presented previously is improved to provide the loop index variable initialization, and to enable a different variable identifier to be used in nested loops:
for for {(}var ${1} = 0;;{)} {{}{ENTER 2}{}}{UP 2}{END}{LEFT 4}
In the macro definition, the loop index variable identifier is given as ${1}, which stands for the value of the first parameter supplied to the macro.
Macros can take up to nine parameters called ${1} to ${9}. Macro parameters are inserted anywhere in a macro definition except inside other special codes enclosed in braces, such as caret control codes. Each macro parameter is used as many times as necessary. For example, the macro definition can be modified to add the loop index variable increment code automatically, by placing ${1}{+}{+} after the second semicolon.
for for {(}var ${1} = 0;; ${1}{+}{+}{)} {{}{ENTER 2}{}} {UP 2}{END}{LEFT 8}
The plus signs are quoted because they have a special meaning within the macro definition. Macro definitions must be on one line.