0

If-else statements vs Switch

Which of these is more conventional to use

3rd Feb 2017, 8:37 AM
Sadat Adams
Sadat Adams - avatar
5 Respuestas
+ 6
If you don't have any "else if"s then there's not much point in using a switch.
3rd Feb 2017, 9:10 AM
Jafca
Jafca - avatar
+ 6
Can't float, double and string or do bools in switch. Other than that, switch structures are much more compact.
3rd Feb 2017, 9:39 AM
Hatsy Rei
Hatsy Rei - avatar
+ 6
Switching a float, double, string is not feasible.
3rd Feb 2017, 9:42 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
@Hatsy Rei What do you mean you can't?
3rd Feb 2017, 9:40 AM
Jafca
Jafca - avatar
+ 1
personally i like using if staments more. because i think they are more convenient in comparing and i think they are more flexibel.
3rd Feb 2017, 8:53 AM
seyfullah
seyfullah - avatar