Created
March 6, 2017 04:52
-
-
Save itzsaga/7d6ebb5725067f869cbfb046ebb68568 to your computer and use it in GitHub Desktop.
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
| 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