+ 2

Why cant the switch functiom take non integer values

eg: string option; switch(option) { it kept showing switch quantity non integer value

5th Nov 2017, 10:35 AM
OBAwesome
3 Réponses
+ 1
And to add to the Gordie's answer, floats can't be precisely compared for equality. And switch uses just the equality comparisons. As for the strings, they are complex types, comparing strings is a whole function and can't be translated to a CPU command.
5th Nov 2017, 11:32 AM
deFault
+ 1
so I have to use if for multiple choice
5th Nov 2017, 4:09 PM
OBAwesome