Skip to content

Instantly share code, notes, and snippets.

@iseth
Created May 19, 2020 16:28
Show Gist options
  • Save iseth/eb67fbe29288c63941c8c163033b4e12 to your computer and use it in GitHub Desktop.
Save iseth/eb67fbe29288c63941c8c163033b4e12 to your computer and use it in GitHub Desktop.
Elixir Types
defmodule Year do
@typedoc """
A 4 digit year, e.g. 1984
"""
@type cType :: {integer, String.t}
@type year :: integer
@spec current_age(year) :: cType
def current_age(year_of_birth), do: {1, "sss"}
end
IO.inspect Year.current_age(2020)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment