Can you have nested switch statements? Will this be just as efficient as IF-Else statements? It sure does look alot neater.
Cheers!
e.g
Code:switch(a)
{
case 1:
switch(b)
{
case 'm': do something;
break;
}
.
.
.
.
.
.
.
}
Printable View
Can you have nested switch statements? Will this be just as efficient as IF-Else statements? It sure does look alot neater.
Cheers!
e.g
Code:switch(a)
{
case 1:
switch(b)
{
case 'm': do something;
break;
}
.
.
.
.
.
.
.
}
Yes you can nest switch statements. I think its more effective then else if statements most of the time. Their are times such as comparing multiple things at once where else if is better.