Home of web learners
Switch is used to execute code when your value and the value in the condition matched.
Lets look an example:
your input value is two
here,you see that your input variable data try to match with value in case,if the value in case matched with your variable data,then the line after case is going to execute and when break found after executing,then it come out from switch
If any value not matched with case with your input data,then default case works