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.