0
What expression can we put within the parenthesis of a switch statement?like we can use any expression? Switch(any expression)
5 odpowiedzi
+ 2
You cannot use floats or doubles in the switch statement.
I believe also a boolean is impossible for switch.
long might be to.
It's really meant for int (short/byte) or char/string.
+ 1
Yep, any expression is possible!
+ 1
It may not be, but if you want a useful switch case, it should be. A switch case is just like an if-statement with multiple else-if-statements, so you can put anything after case that you could put in an if-statement too
+ 1
thank u very much both of u :)
0
the expression may not be related to the input string then?