Skip to content

Instantly share code, notes, and snippets.

@zacksiri
Created May 7, 2014 15:43
Show Gist options
  • Save zacksiri/fd40c10194716717969c to your computer and use it in GitHub Desktop.
Save zacksiri/fd40c10194716717969c to your computer and use it in GitHub Desktop.
defmodule Bank do
use Application.Behaviour
# See http://elixir-lang.org/docs/stable/Application.Behaviour.html
# for more information on OTP Applications
def start(_type, _args) do
Bank.Supervisor.start_link
end
def start do
await
end
def await do
receive do
{:check_balance, pid} -> divulge_balance(pid)
end
await
end
def divulge_balance(pid) do
send(pid, {:balance, 0})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment