Back to Developer Roadmap

Instance Variables

src/data/roadmaps/ruby/content/[email protected]

4.0859 B
Original Source

Instance Variables

Instance variables in Ruby are variables that hold data specific to an object. They are defined within a class but belong to individual instances (objects) of that class. You create an instance variable by prefixing a variable name with an @ symbol (e.g., @name). Each object of the class will have its own copy of these variables, allowing you to store different values for each object's attributes.

Visit the following resources to learn more: