Skip to content

Instantly share code, notes, and snippets.

@SophieDeBenedetto
Created December 7, 2020 21:31
Show Gist options
  • Select an option

  • Save SophieDeBenedetto/561b09bab32fdd7b6acaf4c33f935e67 to your computer and use it in GitHub Desktop.

Select an option

Save SophieDeBenedetto/561b09bab32fdd7b6acaf4c33f935e67 to your computer and use it in GitHub Desktop.
defmodule Accountant do
@sum 2020
def product_of_equals_twenty_twenty(list, product \\ nil)
def product_of_equals_twenty_twenty(_list, product) when product != nil, do: product
def product_of_equals_twenty_twenty([_head | tail] = list, _product) do
product_of_equals_twenty_twenty(tail, get_two(list))
end
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment