From: Steve Dogers Date: 2009-03-31T04:52:44+09:00 Subject: When to use instance variables @ Hi, I have a couple questions about instance variables in Ruby. 1) do i need to declare them at the top of my class file - I do understand the accessors are automatic but I'm not sure if I can just pull a @product in the middle of a function 2) do i need to use the @ to refer to them in the class. Would it work without the @, and if so, how does it differentiate them from local vars? 3) I've seen code where just below the class declaration, objects are instantiated like product = Product.new - I don't see a @ sign, does that mean it's a local var? How can a local var even exist at the class level, outside a function? Many thanks! -- Posted via http://www.ruby-forum.com/.