Thanks Speedy5.

What I meant when I said it doesn't work with variablesis that the case statements can't contain variables, they have to be constants. The only reason I see that it must be a constant would be that it is storing the values in some sort of organized format that allows the case values to be searched, instead of checking each and every value for equality. I don't think it's actually going from case to case and saying is the Switch variable == to the case value, but instead is just doing some sort of tree search, which would be much faster, especially when you have a whole lot of values.

It is obvious there is a huge speed difference from Speedy5's test. And if you increase the number of values then an if else would slow down linearly because of it's O(n), but the case would probably not slow down nearly as much because of it's O(log2 n) running time.