Re: Which is better coding style...

From: Date: Thu, 19 Apr 2001 22:45:34 +0000
Subject: Re: Which is better coding style...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-49466@lists.php.net to get a copy of this message
I preffer the first. -- Chris Lee lee@mediawaveonline.com ""Boget, Chris"" <Chris.Boget@wild.net> wrote in message news:4040BBE81A9AD411BD27009027887A7C042C91@tiger.wild.net... 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

« previous php.general (#49466) next »