Whats wrong with this switch statement?

Hi mate,

I *think* it's because - if time is not one of 9,10,11,12,1,2,3,4,5 then nothing is returned????
can you not just add a return statement to the default? Should work then
 
^

What he said about the return statement.
You have a function that returns a boolean and it should return a boolean on all code paths.

The unreachable code is likely to do with the break statements.
If you're returning from each of the defined cases then the break statements after each return are never actually reached.
 
^

What he said about the return statement.
You have a function that returns a boolean and it should return a boolean on all code paths.

The unreachable code is likely to do with the break statements.
If you're returning from each of the defined cases then the break statements after each return are never actually reached.

Ah of course, thanks. :)
 
Back
Top Bottom