Progate learning notes What is an instance in a class and an instance variable
class Menu
end
class Menu
attr_accessor :name
attr_accessor :price
end
Now you can give an instance of the Menu class the information name and price. Please refer to the bottom of the page for easy-to-understand comments about ʻattr_accessor`.
What is born from the class
class Menu
attr_accessor :name
attr_accessor :price
end
#An instance called menu1 born from the Menu class
menu1 = Menu.new
#Have information in an instance called menu1
menu1.name = "Bread"
menu1.price = "200"
Reference: Progate