-
Can I nest if/else statements?
I’m trying to use a drop-down menu to contol a layer’s opacity.
If the first item on the drop-down menu is selected, I want to run an if/else statement that will change the opacity depending on another layer’s rotation.
Is this possible with if/else statements? Should I be using switch() instead? If so, how would I write this?
//My first attempt gets an error message:
if (v == 0) {
if (r < 45) {
100;
} else {
0;
} else if (v == 1) {
100;
} else {
0;
}//My second attempt always returns 100 when v==0 and 0 for all other menu items, regardless of the rotation:
if (v == 0 && r < 45) {
100;
} else if (v == 1) {
100;
} else {
0;
}