explain the switch case statement in computer
Answers
Answered by
1
Answer:
A switch statement tests the value of a variable and compares it with multiple cases. Once the case match is found, a block of statements associated with that particular case is executed.
Each case in a block of a switch has a different name/number which is referred to as an identifier. The value provided by the user is compared with all the cases inside the switch block until the match is found.
If a case match is found, then the default statement is executed, and the control goes out of the switch block.
In this tutorial, you will learn-
Similar questions
Biology,
6 months ago
Math,
6 months ago
Social Sciences,
6 months ago
Social Sciences,
1 year ago
Math,
1 year ago
English,
1 year ago
Chemistry,
1 year ago