Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Conditional style (if, &&) query

by Maclir (Curate)
on Oct 17, 2001 at 19:22 UTC ( [id://119431]=note: print w/replies, xml ) Need Help??


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

I would tend to go with option c (the traditional if structure) for the following reasons:

  1. The vast majority of programmers - even non-perl programmers can (or should be able to) understand your intent.
  2. If at some future time, you need to add some additional processing, you can slip another statement in without restructuring the code:
    if ( expr) { a(); # why didn't they think of this before? b(); }
  3. (Updated)You can easily slip an else clause in there when someone realises that is required as well.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-25 13:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found