question about "return value"

1
2
3
4
5
6
7
8
9
switch (sub){   

case'Math':
case'math':

memsbjt = "math';


return 0; 



can i ommit the break; statement if i use return "any value"; statement.
Last edited on
Yes, the return will always jump out of the switch ( since it jumps out of the enclosing function ) so the control flow won't reach following case labels
If its inside of a function wouldn't jump out of the whole function?

So the control flow retuns to its calling function ( the function that called the function the switch statement was in ) right?
Last edited on
it jumps out of the enclosing function
It's just as returning from anywhere else
Thanks.
Topic archived. No new replies allowed.