Yossef Mendelssohn wrote:
> On Jun 29, 2:35m, Rob Biedenharn <R... / AgileConsultingLLC.com>
> wrote:
>> 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.
> Really? This is the first I've heard of this, and it seems kind of
> strange.
> 
> Maybe I'm misunderstanding the point of the 'else' clause, but
> wouldn't you put code that "only gets executed if none of the rescue
> clauses are (i.e., there is no exception)" in the main body of what
> you're adding rescues to? (viz. begin block, method definition)

Counterexample:

begin
  puts "According to your theory, this shouldn't be evaluated, "
  puts "but it will."
  raise RuntimeError
rescue
else
  puts "This, however, won't."
end

jwm