From: Florent Guiliani Date: 2006-10-19T20:53:41+09:00 Subject: Re: My second day of learning Ruby (and my seconds feels) Florent Guiliani a �crit : > First impressions of blocks: > ---------------------------- > > irb(main):293:0* a=[ "aaa", "bbbb", "bbbbbb", "ccc", "dddddd" ] > => ["aaa", "bbbb", "bbbbbb", "ccc", "dddddd"] > irb(main):294:0> a.each { |a| puts a } > aaa > bbbb > bbbbbb > ccc > dddddd > => ["aaa", "bbbb", "bbbbbb", "ccc", "dddddd"] > irb(main):295:0> a > => "dddddd" > > a is changed. scope of the block is not duplicate/separate? I've got my anwser at Chapter 7, Part I of pickaxe Ruby book: Variable Scope, Loops, and Blocks (..cut..) However, if at the time the block executes a local variable already exists with the same name as that of a variable in the block, the existing local variable will be used in the block. Its value will therefore be available after the block finishes. Florent,