[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

retry does not work

T. Onoma

11/20/2003 9:57:00 AM

matz:

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 &lt; [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:

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

thanks matz,
-t0


2 Answers

ts

11/20/2003 10:08:00 AM

0

>>>>> "T" == T Onoma <transami@runbox.com> writes:

T> you rejected my rcr on garden saying that retry already does it. but it
T> does not. maybe there's a trick to it? but i could not read your example
T> b/c it was cut off by the < --you have to use &lt; [Aside: why hasn't
T> this been fixed at garden? argghhh..]

Well the example was probably

def resume_example(x)
print x
x += 4
begin
raise if x < 10
print x
rescue
x = 10
retry
end
puts
end



Guy Decoux




matz

11/20/2003 10:37:00 AM

0

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 &lt; [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.