Skip to content

Instantly share code, notes, and snippets.

@CheezItMan
Forked from dHelmgren/translate_me.rb
Created May 21, 2019 15:20
Show Gist options
  • Save CheezItMan/a8602e3e6137ca52418057e8252dec1a to your computer and use it in GitHub Desktop.
Save CheezItMan/a8602e3e6137ca52418057e8252dec1a to your computer and use it in GitHub Desktop.
Js Translation from Ruby snippet
def coffee_price is_iced, size, flavor_array
price = 2.50
if size == 0
elsif size == 1
price += 1
else
price *= 2
end
if is_iced
price += 0.75
end
flavor_array.each do |flavor|
puts "pumping #{flavor}"
price += 0.50
end
price
end
puts coffee_price true, 3, ["vanilla", "lemon"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment