>>>>> "H" == Hugh Sasse Staff Elec Eng <hgs / dmu.ac.uk> writes:

H> But the manual page states they are the same: "for is the syntax sugar
H> for:" etc.  That was my point.  If they are not equivalent, but they are
H> so near that the author of the manual could confuse the two,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 I don't think that the author of the manual can confuse the two :-)

H> if 'do' and 'end' do not introduce new scope, whereas the braces do. But
H> actually trying this:

 'do' and 'end' introduce new scope, except when used with 'while', 
 'for', ... :-)

H> which seems to be the same as braces to me.  Hmmm.  I thought I
H> understood the difference between braces and do...end.

 There is a difference between 1.4 and 1.6

pigeon% cat b.rb
#!/usr/bin/ruby
def b
   yield 14
end
def foobar(a, b)
   p "#{a} -- #{b}"
end
a = 12
foobar a, b {|i| i}
foobar a, b do |i| 
   i
end
pigeon% 

pigeon% b.rb
"12 -- 14"
"12 -- 14"
pigeon%
 
pigeon% ./ruby b.rb
"12 -- 14"
b.rb:3:in `b': yield called out of iterator (LocalJumpError)
        from b.rb:10
pigeon%
 
pigeon% ./ruby -v
ruby 1.4.6 (2000-08-16) [i686-linux]
pigeon% 


Guy Decoux