Skip to content

Instantly share code, notes, and snippets.

@dHelmgren
Last active May 21, 2019 15:20
Show Gist options
  • Save dHelmgren/36791d8c791289144861f3347c04367a to your computer and use it in GitHub Desktop.
Save dHelmgren/36791d8c791289144861f3347c04367a 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