[Solved] Rewriting if elses into switch statement, i have wrote this code with if elses and need to rewrite as switch
You switch it (see what I did there?) by writing something like this: switch(room.toUpperCase()) { case “P”: //do stuff for P break; case “S”: //do stuff for S break; ….. default: //do what’s in your “else” block break; } The switch statement decides which item to look at, then each case is for each outcome. … Read more