If-else statements vs Switch | Sololearn: Learn to code for FREE!


If-else statements vs Switch

Which of these is more conventional to use

2/3/2017 8:37:13 AM

Sadat Adams

5 Answers

New Answer


If you don't have any "else if"s then there's not much point in using a switch.


Can't float, double and string or do bools in switch. Other than that, switch structures are much more compact.


Switching a float, double, string is not feasible.


@Hatsy Rei What do you mean you can't?


personally i like using if staments more. because i think they are more convenient in comparing and i think they are more flexibel.