William Djaja Tjokroaminata wrote:
> I am sorry that I don't understand what you meant.  I am using ruby 1.6.7
> (2002-03-01) [i686-linux]:
> 
> # -------------------------------------------
> class MyClass
>         def initialize
>                 data = false

Comment out the above line, and all is well.

>                 data ||= true
>                 puts data       # >> true
>                 @data = false

Comment out the above line, and all is still well.

>                 @data ||= true
>                 puts @data      # >> true
>                 @@data = false

Comment out the above line, and you get:
  in `initialize': uninitialized class variable @@data in MyClass
(NameError)

>                 @@data ||= true
>                 puts @@data     # >> true
>         end
> end
> MyClass.new
> # -------------------------------------------
> 
> It seems that the ||= operator works for local, instance, and class
> variables.

For class variables, only when the class variable is already defined.

-- 
(\[ Kent Dahl ]/)_    _~_    __[ http://www.stud.ntnu.no/~kentda/ ]___/~
 ))\_student_/((  \__d L b__/  NTNU - graduate engineering - 5. year  )
( \__\_?|?_/__/ ) _)Industrial economics and technological management(
 \____/_?_\____/ (____engineering.discipline_=_Computer::Technology___)