From: Rand Waltzman Date: 2006-09-17T20:24:03+09:00 Subject: irb question Greetings All I have a question about bindings in the irb when you load a file into it. Here is a sample file I tried loading: def hello puts "hello there" end jello = 42 puts jello I load this file from the irb using: load 'test.rb' The response is that it prints out the number 42. So far so good. If I type hello to the prompt, I get "hello there" as expected. Also so far so good. However, when I type jello I get the following message: NameError: undefined local variable or method `jello' for main:Object from (irb):2 The question is, why was hello bound and jello not? Another interesting phenomenon occurs if I type "hello = 42" to the interpreter, i.e., I try to rebind hello. That seems to work fine as well. If I type hello, I get 42 as expected. However, if I try to reenter the definition of hello as I had it in the original file and try typing hello again, I still get 42. The question is, why didn't it allow me to rebind hello? Thanks for any help on this in advance. Rand -- Posted via http://www.ruby-forum.com/.