0
Switch vs if statement
As far as I can tell, it seems that you can use the switch and if statements to achieve the same results. Am I missing something, or are they more or less interchangeable?
5 Respostas
+ 3
Not every language allows the same types for switch.
In C and C++, you can only use integer types including char.
+ 2
wow thank you all for the quick responses. Seems a but clearer now
+ 1
switch can only use integer values and if statements can use any type of value.
I hope I was helpful :)