Question: IF/ELSE Statements with Increasing Values?
Greetings all,
I'm back with another question, hopefully this one a little more straightforward than the last one (I'm still very grateful to Dan Ebberts for solving that one by the way). This one is kind of a followup.
So, short version: Dan helped me put together an IF/ELSE equation to govern the different layouts I was going to have. Me being me, I underestimated how many different combinations I was going to use, and the number has now reached 20.
Have a look:
var x = effect("Dropdown Menu Control")("Menu").value;
if ( x === 1 ) {
"Fullscreen Talent 1";
} else if ( x === 2 ) {
"Fullscreen Talent 2";
} else if ( x === 3 ) {
"Fullscreen Talent 3";
} else if ( x === 4 ) {
"Fullscreen Talent 4";
} else if ( x === 5 ) {
"Fullscreen Talent 5";
} else if ( x === 6 ) {
"Splitscreen x2 Even - Talent 1 & 2";
} else if ( x === 7 ) {
"Splitscreen x2 Even - Talent 1 & 3";
} else if ( x === 8 ) {
"Splitscreen x2 Even - Talent 1 & 4";
} else if ( x === 9 ) {
"Splitscreen x2 Even - Talent 1 & 5";
} else if ( x === 10 ) {
"Splitscreen x2 Right Video Talent 1";
} else if ( x === 11 ) {
"Splitscreen x2 Right Video Talent 2";
} else if ( x === 12 ) {
"Splitscreen x2 Right Video Talent 3";
} else if ( x === 13 ) {
"Splitscreen x3 Right Video Talent 1 & 2";
} else if ( x === 14 ) {
"Splitscreen x3 Even - Talent 1-2-3";
} else if ( x === 15 ) {
"Splitscreen x4 Even - Talent 1-2-3-4";
} else if ( x === 16 ) {
"Splitscreen x5 Even";
} else if ( x === 17 ) {
"Splitscreen x2 Even - Talent 4 & 2";
} else if ( x === 18 ) {
"Splitscreen x2 Even - Talent 3 & 4";
} else if ( x === 19 ) {
"Splitscreen x3 Even - Talent 3-4-5";
} else if ( x === 20 ) {
"Splitscreen x3 Even - Talent 4-2-3";
}
As you can see, each progreesive "else" loop increases the possible value of "x" by one. My question is, is there a simple way to simply increase the value by one each time? So for instance, the first time around we're looking to see if X = 1. The next time around, instead of saying this:
If thisElse.x = 2
Would it be possible to say something like this:
If thisElse.x = lastXvalue + 1
The reason I'm asking it this way is it would make it possible for me to keep these in some logical order as I need new layouts.
(Dan, any chance you might have a trick up your sleeve for something like this?)
