Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Conditional style (if, &&) query

by DamnDirtyApe (Curate)
on Oct 17, 2001 at 05:55 UTC ( [id://119304]=note: print w/replies, xml ) Need Help??


in reply to Conditional style (if, &&) query

Personally, I would avoid the first choice whenever possible. What about when your code looks like this:
--$option > ($i - 1) && $a = shift;
Not the most complex logic in the world, but IMHO you've already lost a lot of readability. As for the other two, I like the b() if expr; when there's only one expression to do, and the traditional if block any other time. Also, I personally find Stroustoup-style indenting/bracketing the most readable, ie.
if ( expr ) { b() ; }
I'm aware that this bracketing isn't the convention in Perl (if anything is a convention; TMTOWTDI), but it's my personal preference. What do others think?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-03-29 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found