From: Gavri_F@... (Gavri Savio Fernandez) Date: 2003-11-17T16:17:25+09:00 Subject: Re: Local Variable Scope in Ruby2 gabriele renzi wrote in message news:... > > the point is that you don't need to explicitly use a declaration of a > variable outside of the scope of the block. > If you want to use block local variables you would just need to do: > > ary.each do |normal_var,block_local_var_initialized_to_nil | > use the vars > end > does this mean that i can include whatever local variables (local to the block) that i need between the || right after the block parameters. would such variables not affect any variable of the same name used outside the block and not have any effect on such variables? for example, g = 5; puts g; [1, 2, 3].each do |f, g| puts f, g; end; puts g now gives me: 5 1 nil 2 nil 3 nil nil Under Ruby2, would it give me the following? 5 1 nil 2 nil 3 nil 5 Gavri Savio Fernandez ___________________________________________ What if everything is an illusion and nothing exists? In that case, I definitely overpaid for my carpet. - Woody Allen