+ 5
Can (switch) statement do the same as double(if.....else) stament and when can I use each one of them?
3 Respuestas
+ 4
Moaaz Osman
Yes do the same
In multiple if else statement check each and every condition so program will take so much execution time so to avoid this situation we use switch statement because in switch statement once the condition will satisfy then program will terminate there that's why we use break in switch.
+ 2
No
switch is applicable to discrete conditions only.
if else is applicable to both discrete and continuous conditions.
0
We can check many conditions in single if statement but in switch statement, we must have exact answer to check.