From: "Scott H." Date: 2013-06-12T01:04:17+09:00 Subject: Loop with range question Hi All, working through understanding loops. Would someone explain why I cannot use “next if i=3..6” or “next if i=(3..6)” in code below. After each I inserted what I thought I should see as a result versus what I did get returned. - Scott ================ i=0 loop do i+=1 next if i==3 print "#{i} " break if i==10 end expected => 1 2 4 5 6 7 8 9 10 actual => 1 2 4 5 6 7 8 9 10 (yeah!) ================ i=0 loop do i+=1 next if i== 3..6 print "#{i} " break if i==10 end expected => 1 2 7 8 9 10 actual => warning: integer literal in conditional range (don’t understand, thought it was telling me it does not work because it can’t transform the range on the fly to the actual integers 3,4,5,6) ================ i=0 loop do i+=1 next if i== (3..6) print "#{i} " break if i==10 end expected => 1 2 7 8 9 10 actual => 1 2 3 4 5 6 7 8 9 10 (so I thought by wrapping the range in a “()” it would convert to 3,4,5,6 and then be able to jump over these integers on output) ================ -- Posted via http://www.ruby-forum.com/.