def foo
  return 1
ensure
  return 2
end

foo
=> 2

One Comment

  1. blj

    Interesting, and more…

    def foo
      a = 1
      return a
    ensure
      a = 2
    end

    puts foo
    => 1

Leave a Comment

Enclose code in <code lang="ruby"></code> if you care.
Preview your comment using the button below.