On Tue, Sep 18, 2012 at 12:07 PM, Aleksander Ciesielski <[email protected]> wrote:
> Is it obligatory to use instance variables in classes? Can't we just write
> something like this:
>
> class Test
>     var = 5
>
>     def show
>         puts var
>     end
> end
>
> test = Test.new
> test.show
> p test.var

You can do that.  But it probably does not lead to the result you are
expecting / wanting.

What is it that you want to achieve?

Cheers

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

-- You received this message because you are subscribed to the Google Groups 
ruby-talk-google group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email 
to [email protected]. For more options, visit this 
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en

Reply via email to