Re: switch & continue statements
| From: | Jason Cox | Date: | Tue, 26 Feb 2002 06:31:04 +0000 |
| Subject: | Re: switch & continue statements | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-86195@lists.php.net to get a copy of this message | ||
A switch will match the value to one of the cases and then continue
executing each line until it encounters the end of the switch block or
encounters a 'break'; It doesn't do any other validation after the initial
sucessfull case validation. I've never used a continue inside a switch
block but I doubt it will jump you to the default case.
Hope that helps,
Jason Cox
----- Original Message -----
From: "KAT 44" <mcpatulc@caramail.com>
To: <php-general@lists.php.net>
Sent: Saturday, February 23, 2002 9:13 PM
Subject: [PHP] switch & continue statements
Hello,
I'm not sure if this is a newsgroup, list or direct e-mail
address. In any case, I ask of anybody who can answer my
question to *send me an e-mail* at mcpatulc@caramail.com,
and not answer on the list/newsgroup/etc. (Thank you.)
My question is the following:
When having a switch statement as follows:
switch($value) {
case something:
if(condition) {
do_my_stuff;
} else {
continue;
}
case something_else:
do_my_other_stuff;
default:
show_error_message;
}
Does the continue continue on evaluating (and comparing)
$value to the case statements, or does it give control to
the default: statement?
Simpler put:
Does a "continue" statement within a "switch" statement
pass control to that "switch" statement's "default:"
section?
Thanks,
KAT44
_________________________________________________________
Le journal des abonnés Caramail - http://www.carazine.com
----------------------------------------------------------------------------
----
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php