Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

7MLI7W day three

elixir/day3.livemd

7MLI7W day three

Section

ball_glove = fn ->
  receive do
    {:pitch, pitcher} -> send(pitcher, {:catch, self()})
      after 1000  -> IO.puts "Bored now"
  end
end

catcher = spawn(ball_glove)
send(catcher, {:pitch, self()})

receive do
  {:catch, _pid} ->
    IO.puts("Caught it!")
end