http://qs321.pair.com?node_id=864129


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.