Skip to content

Instantly share code, notes, and snippets.

@itzsaga
Created March 6, 2017 04:52
Show Gist options
  • Select an option

  • Save itzsaga/7d6ebb5725067f869cbfb046ebb68568 to your computer and use it in GitHub Desktop.

Select an option

Save itzsaga/7d6ebb5725067f869cbfb046ebb68568 to your computer and use it in GitHub Desktop.
katz_deli = []
def line(x)
line_array = []
if x.length == 0
puts "The line is currently empty."
else
x.each.with_index(1) do |name, index|
line_array.push("#{index}. #{name}")
end
puts "The line is currently: #{line_array.join(" ")}"
end
end
def take_a_number(katz_deli, name)
katz_deli.push(name)
puts "Welcome, #{name}. You are number #{katz_deli.length} in line."
end
def now_serving(array)
if array.empty?
puts "There is nobody waiting to be served!"
else
puts "Currently serving #{array[0]}."
array.shift
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment