switch expression can’t be float, double or boolean

Float and double would be awkward to use reliably even if they were possible – don’t forget that performing exact equality matches on float/double is usually a bad idea anyway, due to the nature of the representation.

For Boolean values, why not just use if to start with?

I can’t remember ever wanting to switch on any of these types, to be honest. Do you have a particular use case in mind?

Leave a Comment