13.03.2017, 00:44
Since foreach is a macro, it might effect the variable names and so one since "define" is just a text replacement.
example:
So an "if" statement is what have to use.
example:
PHP Code:
#define iter:%1<%2> \
%1limit = %2
#define myLoop(%1,%2) \
for (new %1; %1 < %2limit; %1++)
main()
{
new iter: TEST<10>;
myLoop(i, TEST)
{
}
new iter: TEST2<10>;
myLoop(i, (random(2) ? (TEST) : (TEST2))) // this wont work because the macro\'s "%2limit" will become "(random(2) ? (TEST) : (TEST2))limit" which makes no sense
{
}
}