News for hackers. Stuff that matters.
Re:Nerd Sniping: What does the code do at the end of the page? by tptacek on Tuesday November 24, 2009 @06:07PM (#960145)
It returns false (also in Ruby) --- the "finally" (or "ensure") clause runs after the function body, but before the function epilogue.

It's not really a "paradox" so much as it is very bad style to "return" from a "finally".

Edit

My partner Dave has a much better trick question:

    def foo
        begin
            return false
        ensure
            next
        end
    end
"You win", I told him. "Nah, Google won. But nobody really wins if you write code like that."
Re:Nerd Sniping: What does the code do at the end of the page? by wvl on Tuesday November 24, 2009 @07:46PM (#960334)
Here's a good article that explains what happens: http://blog.leshill.org/blog/2009/11/17/ensure-with-explicit...
Re:Nerd Sniping: What does the code do at the end of the page? by ahlatimer on Tuesday November 24, 2009 @07:42PM (#960324)
The last trick question doesn't work in Ruby, at least not Ruby 1.8.7. Gives me a "LocalJumpError: unexpected next".

I realize that's not the point, but I figured I'd mention it anyway.