Ruby
- A PROGRAMMER'S BEST FRIEND
Hello world
# Ruby knows what you
# mean, even if you
# want to do math on
# an entire Array
cities = %w[ London
Oslo
Paris
Amsterdam
Berlin ]
visited = %w[Berlin Oslo]
puts "I still need " +
"to visit the " +
"following cities:",
cities - visited
Read document
https://devdocs.io/ruby/
Ruby language
https://devdocs.io/ruby-language/
Methods implement
def one_plus_one
1 + 1
end
Calling Methods
one_plus_one()
parenthesis are optional
one_plus_one
Receiver
self - self is the default receiver.
my_object.my_method
#or
self.my_method
Thanks!
Questions?