Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Conditional style (if, &&) query

by chipmunk (Parson)
on Oct 17, 2001 at 05:57 UTC ( [id://119305]=note: print w/replies, xml ) Need Help??


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

I've used each of the above, at different times. (Actually, I use expr and b(); rather than &&.) Which one I prefer at any given time depends on the actual expr and b(), the surrounding code, and the intended audience.

expr and b(); is good when the expr is more significant than the call to b(), or when you're emulating a switch statement.

b() if expr; is good when the call to b() is more significant than the expr, such as b() if $DEBUG;.

if ( expr ) { b(); } is good because it has the clearest structure, especially for people familiar with other languages.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-25 05:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found