On Jun 29, 2009, at 3:19 PM, David A. Black wrote:
> Hi --
>
> On Tue, 30 Jun 2009, Matt Neuburg wrote:
>
>> David A. Black <dblack / rubypal.com> wrote:
>>
>>> Hi --
>>>
>>> I've put together some RDoc-style documentation for the Ruby  
>>> keywords.
>>> It's at http://www.wobblini.net/keywords.
>>
>> Not true that rescue "Must occur either inside a begin<code>/ 
>> <code>end
>> block or a method definition (which implies begin)."
>>
>> Counterexample:
>>
>> puts "first line"
>> raise "oops" rescue puts "no problem"
>> puts "last line"
>>
>> Or has this changed in 1.9? I focus on rescue because discovering  
>> this
>> single-expression version of rescue is not easy for beginners. m.
>
> It's still there -- I'll add it. Thanks.
>
> David
>
> -- 
> David A. Black / Ruby Power and Light, LLC
> Ruby/Rails consulting & training: http://www.rubypal.com
> Now available: The Well-Grounded Rubyist (http://manning.com/black2)
> "Ruby 1.9: What You Need To Know" Envycasts with David A. Black
> http://www.envycasts.com

Since its related to 'rescue', I'll point out that you can also use  
'else' to indicate code that only gets executed if none of the rescue  
clauses are (i.e., there is no exception). This is, of course, not  
like 'ensure' with is executed regardless.

This point should be added to 'else' even if it refers to the rescue  
and/or ensure docs (which don't mention this use of 'else' either).

-Rob

Rob Biedenharn		http://agileconsultingllc.com
Rob / AgileConsultingLLC.com