Attr_accessor:
While initializing object you can assign the value to it. Check the following example and practice it.
- class Person
- attr_accessor :name
- def initialize(name)
- self.name = name
- end
- end
- person = Person.new("Andreas")
- puts person.name
- person.name = "David"
- puts person.name
- Hope you will practice it, i will get back to you with new concept.
Ruby tutorial session 5
Subscribe to:
Posts (Atom)
My Experience in RUBYCONF INDIA 2016
Hi Readers, Rubyconf India is a global event complementing other RubyConf events across the world. I attended this event held on 19-20 ma...
-
Hi Amigos, Today i would like to share something which i achieved today. There is one Post i saw few days back in Facebook. What th...
-
Hi Guys, Today i want to share something new with the readers. I got an idea in my mind, i am already sharing my knowledge through this b...
-
Hi Readers, This is the last post for Ruby beginners. Today we are going to learn some small concepts and Ruby load paths and auto ...
No comments:
Post a Comment