question about "return value"

Sep 28, 2010 at 10:08pm
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 Sep 28, 2010 at 10:10pm
Sep 28, 2010 at 10:39pm
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
Sep 28, 2010 at 10:41pm
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 Sep 28, 2010 at 10:42pm
Sep 28, 2010 at 10:53pm
it jumps out of the enclosing function
It's just as returning from anywhere else
Sep 28, 2010 at 10:54pm
Thanks.
Topic archived. No new replies allowed.