Posted By

adrianparr on 02/12/11


Tagged

select Switch case conditional break if else as3 statement


Versions (?)

AS3 Switch Statement Example


 / Published in: ActionScript 3
 

URL: http://www.republicofcode.com/tutorials/flash/as3switch/

  1. switch (myVariable) {
  2. case 1:
  3. // Do something here
  4. break;
  5.  
  6. case 2:
  7. // Do something here
  8. break;
  9.  
  10. case 3:
  11. // Do something here
  12. break;
  13.  
  14. default:
  15. trace ("None of the above cases were met")
  16. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: feeorin on February 22, 2011

you can also have multiple cases to execute the same function / logic for example

switch (myVariable) { case 1: case 2: break;

case 3:
break;

default:

}

You need to login to post a comment.