Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: if statement consolidation

by Anonymous Monk
on Jun 27, 2012 at 20:33 UTC ( #978763=note: print w/replies, xml ) Need Help??


in reply to if statement consolidation

There is also something to be said for clarity. The only real caution here is that you probably want to be using elsif especially if there is any chance whatsoever that the value of $h could be modified within any of the if-blocks. Even though the code as written (with the elsif change) is wordy and repetitious, it is also easy to understand and modify, and each alternative block of code stands alone. You could, if you chose and if you needed to, do completely separate and unrelated things in each block: there is no functional correlation or "tying" of any kind between them. If that works for you, all things properly considered, then do it without remorse. it is not "wrong."

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://978763]
help
Chatterbox?
Jar. Jar!...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (1)
As of 2016-12-04 12:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (64 votes). Check out past polls.