From: "Richard P. Groenewegen" Date: 2001-04-09T23:17:13+09:00 Subject: [ruby-talk:13576] about the the scope of a local variable Hi, In the Dave/Andrew book it says (on page 215): ``However, the scope of a local variable is statically determined to be: the immediately enclosing block, method definition, class definition, module definition, or top-level program.'' Hence I thought that in the following situation +----------------+ +--------------------+ | file: atest.rb | | file: btest.rb | +----------------+ +--------------------+ | a = 10 | | require 'atest.rb' | | | | puts a | +----------------+ +--------------------+ the variable a would be avaible in the `puts' line, because it is only enclosed by the top-level program. But this gives a `underfined local variable' error. Why is this? At first I thought that the require-line maybe was implicitly surrounded by a block, but this is not so: if I put `a = 1' before the require line, the value of a stays 1. Is there any way to access the `a' in atest.rb? Richard -- Your mousepad is incompatible with your operating system. --dogbert