Previous topicNext topic

for and while loops in expressions

Questions, comments, feedback, etc.
Post Reply
knuty123
Posts: 8
Joined: Fri Feb 03, 2023 2:36 pm

for and while loops in expressions

Post 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?
:?
Sadler
Posts: 1142
Joined: Sat Aug 02, 2014 7:10 pm
Location: London, UK

Re: for and while loops in expressions

Post 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.
knuty123
Posts: 8
Joined: Fri Feb 03, 2023 2:36 pm

Re: for and while loops in expressions

Post 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. :)
Post Reply