[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04164] Basic variable question

From: Johann Hibschman <johann@...>
Date: 2000-07-21 19:16:09 UTC
List: ruby-talk #4164
Hi folks,

I'm trying to figure out, well, where all the variables go when I
load a file.

If I have a file, test.rb, that includes a variable definition, such
as

  a = 10

and I then load that file from irb using 'load "test.rb"', can I access
that variable in any way?  I actually expected that to give me an error,
since 'a' isn't a global, but it didn't.

Clearly, if I used $a, I'd get a global variable.  But 'a' has to
go in some namespace, right?  If I defined a class in test.rb and
loaded it, the name of that class would be inserted into the global
namespace, but simple variables are not, correct?

-- 
Johann Hibschman                           johann@physics.berkeley.edu

In This Thread

Prev Next