Instance Variable

If you have a class ‘Thing’

does name of instance variable have to be:

@thing =

or is

@widget =

O.k. to use?


Variables can be named whatever you’d like. Feel free to use

@widget =

If you feel that ‘widget’ is a good name.

El Martes, 12 de Enero de 2010, BlueHandTalking
escribió:> O.k. to use?
local_aaa =
$global_ccc =
a_n_y =
@attribute_1 =
@@class_var2 =

any is valid, so any kind of attribute name is also valid.

Again I think you ask this because Rails conventions. If so remember
that this is a Ruby maillist, and Rails rules/conventions are not a must


Thanks for the example list.

Actually, I did not ask because it is a Rails thing.

I asked because I needed some fundamental, like very
basic knowledge about Ruby that I did not understand.

…and I did RTFM before this post.

Thanks again,


On 2010-01-12, BlueHandTalking [email protected] wrote:

O.k. to use?
How far do you think you’d get if you could only use “@fixnum” for
values used as instance variables?

For that matter, what name would you give to an instance variable that
might, like any other variable in the language, hold different types of
objects in different contexts?

In short, the name is purely up to you.