Skip to content

Instantly share code, notes, and snippets.

@cheeyeo
Forked from benwbrum/freeukgen_interview.rb
Created October 8, 2016 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cheeyeo/a86cf974ea37d23bb4130bca1109fe9c to your computer and use it in GitHub Desktop.
Save cheeyeo/a86cf974ea37d23bb4130bca1109fe9c to your computer and use it in GitHub Desktop.
Coding challenge/interview prompt for Free UK Genealogy developer
# Create a Person class which will print the following output when run:
# Jane Doe
# John Smith
# YOUR CODE GOES HERE
class Person
attr_accessor :first_name, :last_name
def initialize(first_name="", last_name="")
@first_name = first_name
@last_name = last_name
end
def print_name
"#{@first_name} #{@last_name}"
end
end
p1 = Person.new
p1.first_name = 'Jane'
p1.last_name = 'Doe'
p1.print_name
p2 = Person.new('John', 'Smith')
p2.print_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment