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-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
exit from def?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password