title: Receive multiple messages in an Erlang process
body: <p>I'm having trouble understanding how to receive multiple messages with an Erlang process. Here's what I tried in the shell:</p>
  
  <pre><code>1&gt; GetMessage = spawn(fun() -&gt; getMessage() end).
  &lt;0.252.0&gt;
  2&gt; GetMessage ! msg.
  Got a message
  msg
  3&gt; GetMessage ! msg
  msg
  </code></pre>
  
  <p>Code for <code>getMessage/0</code>:</p>
  
  <pre><code>getMessage() -&gt;
    receive
      _ -&gt;
        io:format("Got a message~n", [])
  end.
  </code></pre>
  
  <p>How can I keep receiving messages? </p>