From: Gennady Date: 2003-05-30T05:53:11+09:00 Subject: Return from ensure Hi, Rubyists Actually, I saw a remark on ruby-talk once that "return" is dagerous, however I could not imagine it is that dangerous. Today I spent 2 hours debugging the code that looked perfectly normal otherwise. I was able reduce the code to the following fragment: def test begin raise "ERROR" ensure return "some value" end end test puts "Nothing happened" Yes, it prints out "Nothing happened", and if you comment out "return" you will see the exception. I just wanted to provide a return value for the function here, so I naturally used "return" statement. I know that in Ruby you can return something without explicit "return" and I usually do this every time. However, at that unfortunate moment my instinct injected "return" -- and, here we go, 2 hours of fun. Any comments? Gennady.