Skip to content

Instantly share code, notes, and snippets.

@Tombarr
Created January 8, 2019 02:14
Show Gist options
  • Select an option

  • Save Tombarr/e20bdba4f9f28c5141b571103198f97c to your computer and use it in GitHub Desktop.

Select an option

Save Tombarr/e20bdba4f9f28c5141b571103198f97c to your computer and use it in GitHub Desktop.
Argument reassignment doesn't work in Elixir
defmodule Greeting do
def hey(name) do
name = name || "Tom"
IO.puts "Hey, " <> name
end
end
test_name = nil
Greeting.hey(test_name) # Hello, Tom
test_name # nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment