Created
October 26, 2017 09:40
-
-
Save zacck-zz/a5778b338388bfd60dbbdd375c862b25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prices = [12,45,78,90] | |
defmodule Total do | |
def totaller([h|t],tot) do | |
totaller(t, tot+h) | |
end | |
def totaller([],tot), do: tot | |
end | |
IO.puts Total.totaller(prices, 0) | |
# => 225 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment