Answer the question
In order to leave comments, you need to log in
How best?
1 option:
switch(a)
{
case 0:
{
b = 2;
return 1;
}
case 1:
{
b = -1232;
return 1;
}
case 2:
{
b = 12322;
return 1;
}
}
switch(a)
{
case 0:
{
b = 2;
}
case 1:
{
b = -1232;
}
case 2:
{
b = 12322;
}
}
Answer the question
In order to leave comments, you need to log in
firstly, in the second option, a break is needed, and secondly, this is not an optimization that you should worry about, but rather a matter of taste.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question