What is the difference between switch case and if else statement? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between switch case and if else statement?

22nd Sep 2016, 2:59 PM
Debangshu Singh
Debangshu Singh - avatar
2 Answers
+ 2
A switch statement can always be translated to a chain of if else statements, but the opposite is not necessarily true.
22nd Sep 2016, 8:48 PM
Zen
Zen - avatar
+ 1
IF else - It is used for taking a decisions Switch statement - It is used to test the value of the given variable against a list of case value
25th Sep 2016, 6:44 AM
preet
preet - avatar