Re: elseif without else

From: Date: Fri, 01 Mar 2002 00:56:11 +0000
Subject: Re: elseif without else
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-86691@lists.php.net to get a copy of this message
Perfectly legitimate... it is much like having a switch statement without a default clause. ----- Original Message ----- From: "Erik Price" <pricee@hhbrown.com> To: "PHP (E-mail)" <php-general@lists.php.net> Sent: Thursday, February 28, 2002 7:32 PM Subject: [PHP] elseif without else > For any of you PHP legal eagles: > > I rtfm'd, but the "elseif" page doesn't say -- is it okay to have > > if ($x) { > // do something > } elseif ($y) { > // do something > } elseif ($z) { > // do something > } > > without a final "else"? My code works fine -- so I know that you -can- > do this. What I was wondering is if this is something that is likely to > get deprecated at some point in the future. IOW, is it "legitimate", > regardless of how it works? > > > Thanks, > > Erik > > PS: is it bad coding style to do the above? I'd like comments on that > too if applicable. My if statements check for conditions and then set a > variable, and later in the script if that variable exists then something > else happens. Is this "sloppy"? > > > > > > ---- > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > pricee@hhbrown.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#86691) next »