Re: CS discussion
| From: | Jon Parise | Date: | Tue, 15 Jul 2003 20:04:42 +0000 |
| Subject: | Re: CS discussion | ||
| References: | 1 2 3 4 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-60@lists.php.net to get a copy of this message | ||
On Tue, Jul 15, 2003 at 02:22:12PM +0100, Bruno Pedro wrote:
> > > How about this:
> >
> > > <?php
> > > if (
> > > (condition1) ||
> > > (condition2)
> > > ) {
> > > action1;
> > > } elseif (
> > > (condition3) &&
> > > (condition4)
> > > ) {
> > > action2;
> > > } else {
> > > defaultaction;
> > > }
> > > ?>
> >
> > I think, this version is althought quite good! Even better than mine!
>
> It might *look* better but it has a problem: the operators. The lines
> should break before the operators, not after. But breaking the lines
> before the operators decreases readibility:
>
> <?php
> if (
> (condition1)
> || (condition2)
> ) {
> action1;
> }
> ?>
I disagree. The operator should remain on the original line to
indicate that the line itself should be continued. It is unnatural to
write something like this:
(something + somethingElse
+ anotherThing)
--
Jon Parise (jon@php.net) :: The PHP Project (http://www.php.net/)