From: Michael Campbell Date: 2002-10-03T04:20:32+09:00 Subject: Re: bugs --- "Kontra, Gergely" wrote: > >> k='Hello' > >> [1,2,3].map {|k| k} > >> puts k > >> > >> It prints 3 under ruby1! > > > >Yes, using block argument equals to assignment to it. > > But shouldn't it be local to the block? It may cause nice errors... > If it is available outside the block, it is a Bad Idea(tm). This is a "Ruby Gotcha". *IF* you declare a variable before the block, it uses that one. If you don't, it creates its own, but its scope IS the block. I find this... odd, and I don't like it, but that's the way it is. ===== -- Use your computer to help find a cure for cancer: http://members.ud.com/projects/cancer/ Yahoo IM: michael_s_campbell __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com