From: craig duncan Date: 2000-12-22T05:51:00+09:00 Subject: [ruby-talk:7913] Re: Vars in blocks GOTO Kentaro wrote: > > In message "[ruby-talk:7832] Vars in blocks" > on 00/12/21, craig duncan writes: > >#!/usr/bin/ruby > > > >%w{ abc def ghi }.each do |s| > > sn = s > >end > > > >p sn > > > > > >But the output is: > > > >/home/craig/ruby/tst.rb:7: undefined local variable or method `sn' for > ># (NameError) > > See The Ruby Language FAQ: Variables, constants, and arguments, > 4.2 What is the scope of a local variable? > > http://www.rubycentral.com/faq/rubyfaq-4.html#ss4.2 > > -- Gotoken Thanks. I've been reading my downloaded Ruby doc. (Debian dist) and the FAQ doesn't have this in it (online is more current). I'll read the online doc from now on.