turning a 'switch' statement into a 'for' loop?
Hi friends
for some reason I cannot figure out this stupid little thing, maybe I must go sleep.
I'm trying to use a for loop instead of a switch statement. The switch looks like this:
PHP Code:
switch(Number(abc))
{
case 1:
playChance[1] = 1;
playChance[2] = 2;
playChance[3] = 3;
break;
case 2:
playChance[1] = 2;
playChance[2] = 1;
playChance[3] = 3;
break;
case 3:
playChance[1] = 3;
playChance[2] = 1;
playChance[3] = 2;
break;
}
and the for loop to replace the switch is not working, here's my frustration:
PHP Code:
playChance[1] = Number(abc);
for(var i = 2; i <= 3; i++)
{
for(var j = 1; j < 3; j++)
{
if(playChance[1] != j)
playChance[i] = j;
}
}
I don't know what I'm doing anymore, can someone please help?
Thanks a ton