Is there much difference between if statement and select case statement? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is there much difference between if statement and select case statement?

10th Jul 2016, 7:44 AM
sumptuousharry
sumptuousharry - avatar
3 Answers
+ 6
Huge difference: Switch Case has better efficiency and is faster and it uses a jump table method to reach the required block to execute. If-else uses different technique! In "if" statement, we can easily provide a range condition (for example: age>=18 && age<=45). There is no such option when using switch case: We can only provide a particular value while using switch case. Both have their own importance in different types of programs.
17th Jul 2016, 1:06 PM
Vibhu Agarwal
Vibhu Agarwal - avatar
0
Both have their own importance in different types of programs.
25th Jul 2016, 7:12 AM
Amin Sadat
Amin Sadat - avatar
- 5
no difference in functionality
15th Jul 2016, 9:50 PM
sam DD
sam DD - avatar