switch case

Tests a condition against any number of case conditions.

 

Break must be used to terminate the switch, or the next statement will be executed.

 

A default case is utilised for when no condition is met.

 

This example asks the user to enter a value in a dialogue box and then checks it against the values in the switch case code block:

Save & refresh browser:

You entered 5

Leave a Reply