learning-to-code/ruby/soda_methods.rb

13 lines
285 B
Ruby
Raw Normal View History

2021-01-23 04:16:02 +00:00
def order_soda(flavor, size = "medium", quantity = 1)
if quantity == 1
plural = "soda"
else
plural = "sodas"
end
puts "#{quantity} #{size} #{flavor} #{plural}!"
end
order_soda("orange")
order_soda("lemon-lime", "small", 2)
order_soda("grape", "large")