Skip to content

Instantly share code, notes, and snippets.

@BrooklinJazz
Created June 8, 2021 00:17
Show Gist options
  • Select an option

  • Save BrooklinJazz/e4f71bc5f3cafd1a3b76778b5956ccbe to your computer and use it in GitHub Desktop.

Select an option

Save BrooklinJazz/e4f71bc5f3cafd1a3b76778b5956ccbe to your computer and use it in GitHub Desktop.
Elixir example using when in a function
defmodule Greeting do
def say_hello(name) when name === "Brooklin" do
"Oh it's just you again"
end
def say_hello(name) do
"Hello #{name}"
end
end
Greeting.say_hello("Brooklin") # Oh it's just you again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment