I preffer the first.
--
Chris Lee
[EMAIL PROTECTED]
""Boget, Chris"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Which is better?
function blah() {
switch( $bob ) {
case 1:
return "this";
case 2:
return "that";
default:
return "other";
}
}
function blah() {
$retval = "";
switch( $bob ) {
case 1:
$retval = "this";
break;
case 2:
$retval = "that";
break;
default:
$retval = "other";
break;
}
return $retval;
}
In other words, is it good practice to exit out of a block (any
block... not just switch; if, for, while) prematurely as demon-
strated in the first example? Or should you do it as demon-
strated in the second example?
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]