Loop Sum Need Help ASAP

So basically I have to make a “Menu” and it asks you to enter all the item you want until you enter “0”. When you enter ‘0’ it should give you a total amount you owe…

I cant seem to get the sum of the orders…

this is what I have so far

menu_items = [“Hamburger”, “Cheeseburger”, “Larger Fry”, “Small Fry”, “Fountain Drink”, “Chips”,“Hot Dog”, “Pop Corn”, “Candy Bar”,“EXIT MENU AND PRINT RECEIPT” ]
menu_items [0] == 2.25
menu_items [1] == 2.75
menu_items [2] == 1.75
menu_items [3] == 1.25
menu_items [4] == 1.00
menu_items [5] == 0.50
menu_items [6] == 2.00
menu_items [7] == 1.25
menu_items [8] == 0.75

puts menu_items

selection = []
until selection == 0
puts "Enter your selection: "
selection = gets.chomp.to_i
if selection == 0
sum = selection.map {|sum,e| + e.to_i }
end
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs