actionscript 3 - What is the best/easiest way to use nested switch/case statements? -


What is the best practice of the following two switch / case statements?

Is there any easy way (less code) to do this?

  switch (myValue) {Case 1: {methodFor1 (); break; } Case 2: Case 3: {methodFor2or3 (); If (myValue == 2) methodFor2 (); If (myValue == 3) methodFor3 (); break; }} ... or ... switch (myValue) {case 1: {methodFor1 (); break; } Case 2: Case 3: {methodFor2or3 (); Switch (myValue) {case 2: {methodFor2 (); break; } Case 3: {methodFor3 (); break; }         }          break; }}  

  switch (myValue) {case1: methodFor1 (); break; Case 2: Method For2or3 (); MethodFor2 (); break; Case 3: Method For2or3 (); MethodFor3 (); break; }  

Why all troubles just repeat the methodFor2or3 () once ?


Comments