chen-w
7/19/2017 - 6:13 PM

switch

switch


switch (variable) {
    case 0:
        blabla;
        break;
    case 1:
    case 2:
    default:
        blabla;
        break;
  }
  
  Note:
  You must add break; after each effective case. Otherwise it will run through all the codes.