From: Hans Mackowiak Date: 2013-03-06T03:33:50+09:00 Subject: Re: How `next` works in ruby with `unless` ? Kumar R. wrote in post #1100229: > Kumar R. wrote in post #1100105: >> John W Higgins wrote in post #1100104: >>> What do you think the only possible order of execution would be? It's >>> not >> >> I did that after reading the description - `The `next` statement is used >> to skip a part of the loop and continue with the next iteration of the >> loop.` > >> line : "next puts "hi" unless n == 5 " . > > next generally used to skip the part of execution and send the control > to the beginning. But how the in between part puts "hi" has been > executed. Why does next not skip this statement ? its because puts "hi" is evaluated first and THEN the result of it is given to the next keyword (in the case of puts it is nil) -- Posted via http://www.ruby-forum.com/.