Computer Science, asked by TbiaSamishta, 1 year ago

rewrite the following code using if else if statement. switch(direction) { case "N" : a = "North"; break; case "E" : a = "East"; break; case "W" : a = "West"; break; case "S" : a = "South"; break; default : a = "Enter correct code"; } document.write (a)

Answers

Answered by Sidyandex
1

While writing an ‘if else if’ statement, you need to point out to the conditions applied to them.

There will be different statements that must be executed as per the conditions are given.

If one statement is not satisfied then we will move towards the second one.

However, out of these different situations, on will fit correctly.

Similar questions