Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Logical expression style

by dada (Chaplain)
on Jul 18, 2002 at 12:02 UTC ( #182772=note: print w/replies, xml ) Need Help??


in reply to Logical expression style

that's how I do it (I know it isn't perlstyle, it's just how I do it):
if( A and B and C ) { # ... } # I drop the extra space when doing 'or': if(A or B or C ) { # ... } # I super-indent when booleans are composite: if( A and ( B or C ) and D ) { # ... }
I *always* leave parentheses on a line by its own, because too often I have to add an 'or C1' that I didn't thought of.

this also goes for lists, BTW. I *always* leave the last dangling comma (many, many times I wish I could do it in C):

my @array = ( $one, $two, $three, );
cheers,
Aldo
__END__ $_=q,just perl,,s, , another ,,s,$, hacker,,print;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2022-05-22 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (78 votes). Check out past polls.

    Notices?