Page 1 of 1

for and while loops in expressions

Posted: Thu Feb 22, 2024 7:59 am
by knuty123
Hi folks :)
I am trying to implement for or while loops in the expression modifier, but I cant get it to work. Is this a limitation of MMV?
:?

Re: for and while loops in expressions

Posted: Thu Feb 22, 2024 1:36 pm
by Sadler
Given there is no Magic specific guidance for expressions and Magic doesn't implement all of ExprTk, for things like this you just have to suck it and see.

If a function is implemented you'll get a param error given nothing else. With a unimplemented function you'll get a reserved keyword error. The Magic help says 'logic and maths' which one might argue should include loops but there's probably a good reason it doesn't.

So yes, loops are not available in Magic expressions. However, Increase, Ramp and other modifiers can do much of what a loop would do.

Were you experimenting or trying to achieve something specific. Maybe there's another way.

Re: for and while loops in expressions

Posted: Fri Feb 23, 2024 9:52 am
by knuty123
thanks a lot for this excellent answer. I did not try anything special. I just wanted to take a deeper dive into the capabilities of the expression modifier, since it is such a powerful feature. :)