User tip! Never exceed a value again.

AtlantenAtlanten Member, PRO Posts: 56
edited November -1 in Working with GS (Mac)
There has been quite a few posts on the forum about values growing too big despite rules and conditions etc.

I thought I'd share a technique that has been really useful for me, and instantly made my projects cleaner and more readable.

It's described in the Wiki, but it's so short that I didn't understand it first. (I'm not used to the math world)

It's the "min" and "max" functions. You can use them to limit values, like this:

If condition is true: change attribute x to min(50,x+1)

So what this does is it chooses whichever number is smaller, 50 or x+1

x will increase by 1 until it reaches 50, then it will just be 50 after that.

You use "max" the same way, except in this case you will get the larger number.

Never exceed a value again...

Hope this helps someone!

Comments

Sign In or Register to comment.