-
-
Save cheeyeo/a86cf974ea37d23bb4130bca1109fe9c to your computer and use it in GitHub Desktop.
Coding challenge/interview prompt for Free UK Genealogy developer
This file contains hidden or 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
# 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