+ 2
what is switch and why it is used plz tell mee?
6 ответов
+ 3
Switch statement is used to select one from many options available. It is like finding your room in a hotel with many rooms. You already know where you have to go. You do not need to check every room whether it is yours or not.
Similarly, in switch statement the execution jumps to the case that matches.
+ 2
switch is used when you have a lot of if/else statements checking the same condition and is typically more efficient because instead of checking each condition it just falls through to the matching case. You can also avoid putting the break statements in to get an effect called falling through which means after a case is matched, it will then fall through all the other cases and execute their code which can be useful for some things.
0
switch is keyword used for performing switch operation.switch operation is used in pick one of the statement if there are many case.
0
switch case....its very simple....selecting one result out of multiple.. depending upon ur case...
its even Hve default case ...when no other case is match ...default case excuted
0
switch is alternatr to if - else statement.switch operation simply executed one case statement out of many cases.
0
to do different work on different value of variable
like use switch for a get variable to specific what user want to do