Skip to content

Instantly share code, notes, and snippets.

@andersr
Created October 13, 2013 15:55
Show Gist options
  • Save andersr/6963805 to your computer and use it in GitHub Desktop.
Save andersr/6963805 to your computer and use it in GitHub Desktop.
my_deli_line = []
def take_a_number(deli_line, customer_name)
deli_line << customer_name
end
def current_line(deli_line)
print "Current line: "
deli_line.each_with_index do |person_in_line, i|
print "#{i + 1}. #{person_in_line} "
end
puts
puts
end
def now_serving(deli_line)
puts "#{deli_line.first}, you're the next customer."
deli_line.shift
end
take_a_number(my_deli_line, "Amber")
take_a_number(my_deli_line, "Billy")
take_a_number(my_deli_line, "Betty")
take_a_number(my_deli_line, "Xavier")
take_a_number(my_deli_line, "Jonesy")
take_a_number(my_deli_line, "Clipper")
take_a_number(my_deli_line, "Bozo")
take_a_number(my_deli_line, "Gonzo")
current_line(my_deli_line)
now_serving(my_deli_line)
now_serving(my_deli_line)
now_serving(my_deli_line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment