Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A simple restaurant robot
# Restaurbot
$done = false
orders = [
'pizza', 'macaroni'
]
puts 'Hello. What is your name?'
$name = gets.chomp.capitalize
puts 'Hello, ' + $name + '.'
if $name == 'Ben'
puts 'You\'re awesome!'
else
puts 'You\'re stupid!'
end
until $done == true
puts 'What would you like to order, ' + $name + '?'
puts 'There are currently ' + orders.length.to_s + ' available orders.'
puts 'Type "add" to add an order, "order" to display the orders, or "del" to delete an order.'
$choice = gets.chomp.downcase
if $choice == 'add'
puts 'Type the name of the order you want to add:'
$order_add = gets.chomp.downcase
orders.push($order_add)
puts 'Order ' + orders.last + ' has been added!'
end
if $choice == 'del'
puts 'Type the name of the order you want to delete:'
$order_del = gets.chomp.downcase
orders.delete($order_del)
puts 'Order ' + $order_del + ' has been deleted!'
puts 'These are the current orders:' + orders.to_s + ''
end
if $choice == 'order'
puts 'These are the current orders:' + orders.to_s + ''
puts 'Type the name of the order you want to order:'
$order = gets.chomp.downcase
if orders.include?($order)
puts 'WEIRDO'
else
puts '' + $order + ' is a really weird food!'
$done = true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment