matz
11/20/2003 10:37:00 AM
Hi,
In message "retry does not work"
on 03/11/20, "T. Onoma" <transami@runbox.com> writes:
|you rejected my rcr on garden saying that retry already does it. but it does not. maybe there's a trick to it? but i could not read your example b/c it was cut off by the < --you have to use < [Aside: why hasn't this been fixed at garden? argghhh..]
|
|so please show me how resume would work with retry here. here is the example again:
Check the code carefully (note where "begin" is). It's not just
replacing resume with retry. "retry" jumps back to "begin".
|def resume_example(x)
| begin
| print x
| x = x + 4
| if x < 10
| raise
| end
| print x
| rescue
| x = 10
| resume # if retry -> 51014
| end
| puts
|end
|resume_example(5) # -> 510
def resume_example(x)
print x
x = x + 4
begin
if x < 10
raise
end
print x
rescue
x = 10
retry
end
puts
end
resume_example(5) # -> 510
matz.