So if I try to nest three for loops inside each other I will get an error, e.g.:MapTool 1.3 Release's macro language allows the nesting of operations (such as branching and looping operations) via the use of the CODE roll option and curly braces to demarcate groups of operations. However, you are restricted as to how many levels deep you can "nest" such operations. Use of the CODE block can extend only two levels deep
Code: Select all
[for(i,0,2,1), code:
{
[output = strformat("<b>i is %{i}:</b> ")]
[for(j,0,3,1), code:
{
[output = strformat("j is %{j}")]
[for(k,0,2,1), code:
{
[output = strformat("<i>k is %{k}</i>")]
}]
}]
[output = strformat("<br>")]
}]
Code: Select all
[for(i,0,2,1), code:
{
[output = strformat("<b>i is %{i}:</b> ")]
[for(j,0,3,1), code:
{
[output = strformat("j is %{j}")]
[for(k,0,2,1): output = strformat("<i>k is %{k}</i>")]
}]
[output = strformat("<br>")]
}]
I run into the same problem when I want an if-comparison inside two nesting for loops (with more than one command), e.g.:
Code: Select all
[for(i,0,2,1), code:
{
[output = strformat("<b>i is %{i}:</b> ")]
[for(j,0,3,1), code:
{
[output = strformat("j is %{j}")]
[if( j > 1 ), code:
{
[h: someVar = 1]
[output = strformat("<i>j is big.</i>")]
};{
[h: someVar = 0]
[output = strformat("<i>j is small.</i>")]
}]
}]
[output = strformat("<br>")]
}]