Skip to content

Instantly share code, notes, and snippets.

@dthomas
Created December 2, 2014 17:17
Show Gist options
  • Select an option

  • Save dthomas/045302f10150cbed3bff to your computer and use it in GitHub Desktop.

Select an option

Save dthomas/045302f10150cbed3bff to your computer and use it in GitHub Desktop.
Range Matching in Elixir
def grade(marks) do
cond do
marks in 91..100 -> "A+"
marks in 81..90 -> "A"
end
end
@chrismccord

Copy link
Copy Markdown
  def grade(mark) when mark in 91..100, do: "A+"
  def grade(mark) when mark in 81..90,  do: "A"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment