Created
September 26, 2013 23:27
-
-
Save ivanbrennan/6722050 to your computer and use it in GitHub Desktop.
Conference Badges and Schedules
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 get_badge(name) | |
"Hello, my name is #{name}." | |
end | |
def get_badges(names_arr) | |
badges_arr = [] | |
names_arr.each do |name| | |
badges_arr << get_badge(name) | |
end | |
badges_arr | |
end | |
speakers_arr = ["Edsger", "Ada", "Charles", "Alan", "Grace", "Linus", "Matz"] | |
def assign_rooms(speakers_arr) | |
room_assigns = [] | |
speakers_arr.each_with_index do |speaker, number| | |
room_assigns << "Hello, #{speaker}! You'll be assigned to room #{number+1}!" | |
end | |
room_assigns | |
end | |
def printout(names) | |
badges = get_badges(names) | |
schedule = assign_rooms(names) | |
badges.each {|badge| puts badge} | |
schedule.each {|assignment| puts assignment} | |
end | |
printout(speakers_arr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment