From: Kristof Bastiaensen Date: 2004-05-01T22:59:01+09:00 Subject: Re: Lazy evaluation (evil) On Sat, 01 May 2004 22:15:52 +0900, ts wrote: > Well, in the original message from matz, there are 2 possibilities > * do || > * let > > [ruby-talk:63199] > > Now, what do you expect with this (for `a' and `b') ? > > 1.times do |i| > let a = i > let b = a + 1 > end > > > Guy Decoux Hi, Both solutions look good to me. The advantage of using do would be that you could see the scope of the variable more clearly. Let however would require less typing, because the above would have been: 1.times do |i| do |a| a = i do |b| b = a + 1; end end end But on the other side, block local variables are probably mostly only useful for closures, so maybe a let keyword is not necessary. The local construct may be nice for initializing block local vars: local(1, 2) do |i, a| puts i + i puts a * a end => 2 => 4 do without anything before it will then initialize to nil. Kristof