In a PRACTICE script, is there an easy way to iterate over a "list of variables/macros"? For example:
; this "list" changes...
PRIVATE &var1 &var2 &var3
; this implementation shall not change
; do something with &var1 &var2 &var3 ...
I would like to be able to add variables without the need to touch the code that iterates over the variables.
I assume you are thinking about a subroutine or separate script that should process a variable numbers of parameters. As the macros are expanded at the time of execution, the callee will not see the macros, but only their contents. So what the callee sees is a list of space separated values. You can write a subroutine that parses the parameters as one string and later separates them using STRing.SPLIT(). Example:
Output:
It is possible to use other separation characters as well, by replacing the BLANK in STRing.COUNT() and STRing.SPLIT(), and of course in the subroutine call.