I am making a MEL expression, however I believe the language is somewhat irrelevant. This question is more of a coding logic question. Normally I would do something like this in javascript (which I am more familiar with) and then translate it but I am kind of stuck with what method to use, i.e. if else, loops, switch, etc?
Here is an example of what I am trying to achieve(I made it in sort of a generic syntax so language doesnt matter so much):
Variable myA is a user input number variable.
Variable myB is a number variable that will adjust based on input from var myA in the following way.
myA:Number;
myB:Number;
my_bool = true;
if (!my_bool){
myB*=-1;
}
if(myA>45){
my_bool = false;
//for every 90 units up switch boolean
}
Basically the comment part is where I am stuck. I want to setup a switch that functions after myA is greater than 45, and then from that point on, switch the my_bool when the var myA goes up 90 units. 45+90=135, so at 135 it will switch to true and 90 units later when myA equals 225, my_bool will switch to false and so on indefinitely. I dont know if I should use an if else, some kind of loop, or if there is something that fits this situation perfectly.