Created
May 8, 2017 20:43
-
-
Save JSRossiter/ac8907bac4d74e0ff18c42a3b6f458cb to your computer and use it in GitHub Desktop.
Instance variables exercise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
attr_accessor(:name) | |
def initialize(name) | |
@name = name | |
end | |
# def name= name | |
# @name = name | |
# end | |
end | |
p = Person.new('L. Ron') | |
p.name = 'Jeff' | |
puts p.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment