in term of executing a program, which is more faster : using "case" or "if else"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

in term of executing a program, which is more faster : using "case" or "if else"?

7th Sep 2016, 7:29 AM
Brad Hendrawan
Brad Hendrawan - avatar
2 Answers
+ 1
I guess they are translated the same way by the compiler, and thus have the same speed. Using a switch instead of a long chain of else if is better for ease of development and readability.
7th Sep 2016, 8:27 AM
Zen
Zen - avatar
0
Switch case obviously as it is more suitable but else if used in complicate ones
13th Sep 2016, 7:36 AM
Prashanta Paul
Prashanta Paul - avatar