I was looking at building a sub that accepts a variable data set and wondering what the most efficient way to reassign the parameters might be.
Specifically, I wanted to run through the parameters in an ascending loop assigning the parameters to a series of variables using concatation.
The result should be that it will assign parameter values to your variable X in ascending order as %X1, %X2, etc, until it has given each parameter a variable assignment.
This is the structure of what I came up with:
Gosub Parameter_Parser 1 12 123 1234 12345 123456
Halt
Sub Parameter_Parser
Set %TotalParameters %0
Set %ParameterCount 0
Repeat
{
Set %ParameterCount %ParameterCount + 1
Set %CurrentParameter % . %ParameterCount
Set %X . %ParameterCount %CurrentParameter
Display Parameter %ParameterCount of %TotalParameters total is %X . %ParameterCount
}
Until %ParameterCount = %TotalParameters
return