From: Cliff Rosson Date: 2013-03-05T07:26:52+09:00 Subject: Re: How `next` works in ruby with `unless` ? --20cf306f7226787db204d720da52 Content-Type: text/plain; charset=ISO-8859-1 People are so incredibly brash on this forum sometimes. Makes for a cold community. :) On Mon, Mar 4, 2013 at 2:20 PM, Kumar R. wrote: > Matthew Kerwin wrote in post #1100097: > > What Joel said. > > > > Also, why are you calling 'next nil' ? > > My interest is only with that part : > > n = 1 > #=> 1 > loop do > print "#{n}" > n = n + 1 > next puts "hi" unless n == 5 > p "good" > break > end > #1hi > #2hi > #3hi > #4"good" > #=> nil > > In the above code, couldn't understand about which order the lines `puts > "hi"` and `unless n == 5` executed. Which executed first? > > the rest one I pasted here by mistake. Sorry for that. Please ignore the > second part. > > -- > Posted via http://www.ruby-forum.com/. > > -- vizualize.me/cliffrosson --20cf306f7226787db204d720da52 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
People are so incredibly brash on this forum=A0sometimes. = Makes for a cold community.=A0=A0:)

On Mon, Mar 4, 2013 at 2:20 PM, Kumar R. <l= ists@ruby-forum.com> wrote:
Matthew Kerwin wrote in post #1100097:
> What Joel said.
>
> Also, why are you calling 'next nil' ?

My interest is only with that part :

=A0n =3D 1
=A0 =A0 #=3D> 1
=A0 =A0 loop do
=A0 =A0 print "#{n}"
=A0 =A0 n =3D n + 1
=A0 =A0 next puts "hi" unless n =3D=3D 5
=A0 =A0 p "good"
=A0 =A0 break
=A0 =A0 end
=A0 =A0 #1hi
=A0 =A0 #2hi
=A0 =A0 #3hi
=A0 =A0 #4"good"
=A0 =A0 #=3D> nil

In the above code, couldn't understand about which order the lines `put= s
"hi"` and `unless n =3D=3D 5` executed. Which executed first?

the rest one I pasted here by mistake. Sorry for that. Please ignore = the
second part.



--
=
vizualiz= e.me/cliffrosson
--20cf306f7226787db204d720da52--