On 21.11.2007 18:24, Jake Cutter wrote:
> On Aug 20, 2007 4:07 AM, Robert Klemme <shortcutter / googlemail.com> wrote:
>> x = foo.bar.baz rescue nil
> 
> Interesting thread....glad someone else has hit this need.
> 
> How does the above work, exactly? You're rescuing without a block?
> Doesn't it have to be something like:
> 
> begin
>   x = foo.bar.baz
> rescue nil
> end
> 
> ? At least the documentation would suggest so...

The value of the expression is replaced by the value of the expression 
after the "rescue" in this form.  And no, you don't need a block.  The 
Pickaxe 1st edition does not seem to mention it but it's definitively a 
legal Ruby feature.

Kind regards

	robert