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

Re: Are there any other statements that are like return if...?

by shoness (Friar)
on Jun 27, 2008 at 19:07 UTC ( #694433=note: print w/replies, xml ) Need Help??

in reply to Are there any other statements that are like return if...?

Realize that "important stuff" needs to be on the left side of the page because few people have the time to read entire lines to figure out what's going on. ☺

Using this "backwards" style, your code intent stays more visible.

For example, it's common to do this for something like:

print "Here we are..." if $debugging;
Often I'll decide one way or the other based on whether it's a special case or normal case. Be careful though, since as others have pointed out, you can obscure intent as well. Mixing them up, as with this block, I find confusing at a glance. Changing the indentation can help.
if ($unlikely_condition) { &do_that_voodoo; } &that_yoodoo if $typical_case;

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2020-10-27 18:30 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (257 votes). Check out past polls.