From: Chad Perrin Date: 2007-04-04T07:56:36+09:00 Subject: Re: Everything is a object? On Wed, Apr 04, 2007 at 07:49:05AM +0900, Jamal Soueidan wrote: > > I understood everything is a object, and the base class for all objects > is object :) > > so when I try to write just that this line below in my code i get an > error? > > puts just_something.class.to_s > > undefined local variable or method 'just_something' for main:object > > why does this happend? > > I cannot even write this below > > puts 'nil' unless just_something.nil? > > hope someone can help me understand whats wrong :) Basically, everything *that exists* in Ruby is an object. If it doesn't exist yet, it can't be an object. You have to have a "just_something" before it can be an object. You could try creating a "just_something" with an assignment, for instance: irb(main):001:0> just_something = 0 => 0 irb(main):002:0> puts just_something.class.to_s Fixnum => nil -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]