[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

exit from def?

Bu Mihai

7/12/2007 8:47:00 AM

def bla


for i in 1 .. 5
puts i
for j in 1 .. 5
puts j
if j==4
then
here i want to exit the "bla" def if j==4
somenthing like break, but break just
interrupt
the 'j' for not the entire procedure; how
can i do
that?
end

end



end


tnx

--
Posted via http://www.ruby-....

1 Answer

Daniel Lucraft

7/12/2007 8:53:00 AM

0

Bulhac Mihai wrote:
> def bla
>
>
> for i in 1 .. 5
> puts i
> for j in 1 .. 5
> puts j
> if j==4
> then
> here i want to exit the "bla" def if j==4
> somenthing like break, but break just
> interrupt
> the 'j' for not the entire procedure; how
> can i do
> that?
> end
>
> end
>
>
>
> end
>
>
> tnx

...

for j in 1..5
puts j
return if j==4
end

...

best,
Dan

--
Posted via http://www.ruby-....