Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Control Flow - Multiple returns or nested conditionals

by JediWizard (Deacon)
on Oct 08, 2010 at 03:10 UTC ( [id://864129]=note: print w/replies, xml ) Need Help??


in reply to Re: Control Flow - Multiple returns or nested conditionals
in thread Control Flow - Multiple returns or nested conditionals

Actually Marshall, I agree with you whole heartedly. I was quite deliberate in my asking of this question to not state up front which of the implementations I prefer, so that the responses I got would not be influenced by my opinion. It has been my experience that when asking this type of question, the best way to get clear unbiased responses is to remove as much of my subjective position from the description as possible...

That having been said, at this point it is quite clear from the responses in this thread, that my preference for multiple returns is the more popular opinion. That may not do me any good in my disagreement with my colleague, but it does hold some level of personal satisfaction.


They say that time changes things, but you actually have to change them yourself.

—Andy Warhol

  • Comment on Re^2: Control Flow - Multiple returns or nested conditionals

Replies are listed 'Best First'.
Re^3: Control Flow - Multiple returns or nested conditionals
by Marshall (Canon) on Oct 08, 2010 at 04:40 UTC
    I posted some code earlier today at Re: Checking contents of array against contents of a hash. There is a subroutine, is_array_subset() which contains 2 return() statements. I am curious as to how your colleague would code this sub?

    I used less than 10 lines of code (I don't count curly braces or blank lines as lines of code). I actually added the "@extra" feature after doing the main part - and having multiple returns made that easier to do.

Log In?
Username:
Password:

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

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

    No recent polls found