I want a trigger that does something depending on where a variable lies in a number sequence. Now if it was just comparing to a single number I would use a Switch trigger, but because I want to compare it with 2 integers.. I'm not sure what to do without creating like 50 If-then-else statements which I'd really rather not do.
Example of what I have now:
If 20 > x > 25
then do y
else
if 26 > x > 30
then do z
else
etc
etc
Problem is I need to compare it 65 times. Is there some way to list all the conditions > actions in a reasonably ordered list and just feed the variable in once if that makes sense?
I want a trigger that does something depending on where a variable lies in a number sequence. Now if it was just comparing to a single number I would use a Switch trigger, but because I want to compare it with 2 integers.. I'm not sure what to do without creating like 50 If-then-else statements which I'd really rather not do.
Example of what I have now:
If 20 > x > 25
then do y
else
if 26 > x > 30
then do z
else
etc
etc
Problem is I need to compare it 65 times. Is there some way to list all the conditions > actions in a reasonably ordered list and just feed the variable in once if that makes sense?
Create a sub-function that allows you to input the lower and upper bounds, make the function return a boolean.
So your function would be.
(Sorry I code in galaxy, cos i hate GUI)
And you're set.
Hope this is what you're looking for.
That did it. Thanks, that is so much better!
No probs. :) Glad it worked.