From: Brian Adkins Date: 2009-02-26T03:00:20+09:00 Subject: Re: Using "rescue" inline I�aki Baz Castillo writes: > Hi, is it correct the following "rescue" usage? > > myvar = 1 # Fixnum > othervar = myvar.downcase rescue myvar > => 1 > > It seems to work, but is it really correct? Thanks. Naturally, "correctness" depends on what you're trying to accomplish. That is one valid use of rescue as a statement modifier which will assign the value of myvar.downcase to othervar unless the downcase method raises an exception, in which case it will assign myvar instead. You can also use more than one rescue as in: x = foo(y) rescue bar(y) rescue baz(y) rescue nil -- Brian Adkins http://lojic.com/