Created
February 25, 2014 21:33
-
-
Save townie/9218310 to your computer and use it in GitHub Desktop.
This file contains 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
def number_details(number) | |
#returns: Jenny has the number 508.867.5309 and it is their home number | |
phone_numbers_2 = { | |
'Dan' => { | |
home: '508.555.5555', | |
mobile: '508.555.6666' | |
}, | |
'Jenny' => { | |
home: '508.867.5309', | |
mobile: '508.697.5555' | |
}, | |
'Sam' => { | |
home: '508.777.7777', | |
mobile: '508.946.3214' | |
} | |
} | |
names = [] | |
phone_numbers_2.each {|name| names<<name} | |
person = '' | |
location = '' | |
names.each do|person| | |
if person[1][:home] == number | |
puts "#{person[0]} has the number #{number} and it is their home number" | |
elsif person[1][:mobile] == number | |
puts "#{person[0]} has the number #{number} and it is their mobile number" | |
end | |
end | |
end | |
number_details('508.946.3214') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment