title: If..else if statement within receive..end statement?
body: <p>I'm trying to create an <code>if..else if</code> condition in Erlang within a <code>receive..end.</code> statement in order to pass two variables A and B so that they can be tested for equivalence.</p>
  
  <p>In the shell I tried typing:</p>
  
  <pre><code>6&gt; Pid = spawn(ifelse,receiving,[]).
  ** exception error: no match of right hand side value &lt;0.54.0&gt;
  7&gt; 
  </code></pre>
  
  <p>What I wanted was to use <code>Pid ! {self(), 1,2}.</code> and <code>Pid ! {self(), 2,2}.</code> to test both cases but something is wrong.</p>
  
  <pre><code>-module(ifelse).
  -export([receiving/0]).
  
  receiving() -&gt;
      receive
          {Pid,A,B}-&gt;
          if  
              A =:= B -&gt;
                  io:format(" B equals A ~n"),
                  Pid ! "True";
              A =/= B -&gt;
                  io:format(" B does not equal A ~n"),
                  Pid ! "False";
              true -&gt; {error, wrong_value}
          end     
      end.
  </code></pre>
  
  <p>By the way if I have <code>receiving(A,B)</code> instead with two variables how would I spawn that similarly to <code>Pid = spawn(ifelse,receiving,[]).</code>? I tried using <code>Pid = spawn(ifelse,receiving(1,2),[]).</code> but that gave an error.</p>