Skip to content

Instantly share code, notes, and snippets.

@zahodi
Last active October 1, 2015 22:34
Show Gist options
  • Save zahodi/265dbe6a8d66b1f9243b to your computer and use it in GitHub Desktop.
Save zahodi/265dbe6a8d66b1f9243b to your computer and use it in GitHub Desktop.
person class
#!/usr/bin/env ruby
class Person
def greet(first, last)
puts "Hello, #{first} #{last}"
end
end
person = Person.new
person.greet('Bob', 'Smith')
class Person2
def initialize(name, surname)
@name, @surname = name, surname
end
def greet
"Hello, my name is #{@name} #{@surname}!"
end
end
person2 = Person2.new('bob', 'smith')
puts person2.greet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment