From: Todd Date: 2005-11-20T06:22:22+09:00 Subject: Re: Cond loop vs iterator and scope questions James Edward Gray II wrote: > On Nov 19, 2005, at 1:07 PM, Todd wrote: > > > Hello, just 2 simple questions... > > > > 1. Why is it that you cannot have an iterator nested inside a > > conditional loop? I'm sure there's a good reason, but it escapes me. > > You can. Please show us the code and we'll help you find the problem. irb(main):001:0> f=[1,2] => [1, 2] irb(main):002:0> while 1 do irb(main):003:1* f.each do |i| irb(main):004:1* end SyntaxError: compile error (irb):004: syntax error from (irb):004 It seems like irb is trying to close the while with that first end instead of the f.each. Same thing happens with syntax coloring in vim. Todd