From: John W Higgins Date: 2013-03-05T07:51:26+09:00 Subject: Re: How `next` works in ruby with `unless` ? --047d7b3438ae3d2e7404d7213230 Content-Type: text/plain; charset=ISO-8859-1 What do you think the only possible order of execution would be? It's not difficult to look at that and figure out exactly which section is executed first Also - if you are going to test something - at least print out the variable in question AFTER you increment it - it makes your "debugging output" look rather much less helpful to you. Maybe if you got this it would make more sense to you 2hi 3hi 4hi 5"good" ?? http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html - look at the "if and unless modifiers" section. There is also the notion that there is ZERO reason for you to need to write something more complex then necessary when learning something. This works just as fine and you would understand it. n = 1 loop do n = n + 1 print "#{n}" if n < 5 puts 'hi' next end p 'good' break end You are continually trying to add 20 different unknown concepts into your thought stream - take things one at a time - learn them well - then start mixing and matching concepts to see how it comes together. John BTW - even if the parser takes the next puts 'hi' unless n == 5 concept - that's really just not code that is used by anyone that I've seen. Again, mixing too many concepts for no gain at all. --047d7b3438ae3d2e7404d7213230 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable What do you think the only possible order of execution would be? It's n= ot difficult to look at that and figure out exactly which section is execut= ed first

Also - if you are going to test something - at least print = out the variable in question AFTER you increment it - it makes your "d= ebugging output" look rather much less helpful to you.

Maybe if you got this it would make more sense to you

2hi
3hi=
4hi
5"good"

??

http://www.ruby-doc.o= rg/docs/ProgrammingRuby/html/tut_expressions.html - look at the "i= f and unless modifiers" section.

There is also the notion that there is ZERO reason for you to need to w= rite something more complex then necessary when learning something.

= This works just as fine and you would understand it.

n =3D 1
loop= do
=A0 n =3D n + 1
=A0 print "#{n}"
=A0 if n < 5
=A0=A0= =A0 puts 'hi'
=A0=A0=A0 next
=A0 end
=A0 p 'good'<= br>=A0 break
end

You are continually trying to add 20 different u= nknown concepts into your thought stream - take things one at a time - lear= n them well - then start mixing and matching concepts to see how it comes t= ogether.

John

BTW - even if the parser takes the next puts 'hi' u= nless n =3D=3D 5 concept - that's really just not code that is used by = anyone that I've seen. Again, mixing too many concepts for no gain at a= ll.

--047d7b3438ae3d2e7404d7213230--