switch (n){ case 1: //do something break; case 2: //do something break; default: //execute if there's no case match //do something }