Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

(MeowChow) Re2: best practice

by MeowChow (Vicar)
on Aug 27, 2001 at 21:53 UTC ( #108189=note: print w/ replies, xml ) Need Help??


in reply to Re: best practice
in thread best practice

Just as long as ya don't do this...
  
if ($larry) { foo(); } elsif ($mo) { pie(); if ($stooges) { nyack(); } } else { cow(); }

   MeowChow                                   
               s aamecha.s a..a\u$&owag.print


Comment on (MeowChow) Re2: best practice
Download Code
Replies are listed 'Best First'.
Re: (MeowChow) Re2: best practice
by herveus (Parson) on Aug 27, 2001 at 23:09 UTC
    Howdy!

    I guess you'd best not make eye-tracks on my Perl code... :)

    Care to elaborate on your point? Personally, I prefer that my braces align vertically...

    yours,
    Michael

      Not much to elaborate on really, just an aesthetic preference. IMO, it consumes way too much vertical real-estate, and it's harder to scan over. Of course, ymmv :)
         MeowChow                                   
                     s aamecha.s a..a\u$&owag.print
Re: (MeowChow) Re2: best practice
by inverse (Acolyte) on Aug 28, 2001 at 05:27 UTC

    I actually prefered the above style for a long time. But it turns out many people can't stand it because it turns all code into a venisian blind of alternating white and black.

    On the other hand lining up the braces seems very natural.

    I have come up with the following compromise, which sacrifices ease of editing for readability:

    if ($larry) 
    {   foo();
    }
    elsif ($tom)
    {   pie();
        if ($stooges)
        {   nyack();
    }   }
    else # Randal
    {   cow();
    }
    
    BTW: Code Complete rocks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://108189]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2015-07-08 04:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls