title: `when` reserved word in erlang
body: <p>I started off this morning trying to work out what the 'when' statement is used for in erlang. I know the below example is wrong:</p>
  
  <pre><code>do_larger() -&gt;
      io:format("Larger~n").
  
  do_smaller() -&gt;
      io:format("Smaller~n").
  
  
  when_version(Size) -&gt;
      when Size &gt; 10 -&gt; do_larger(),
      when Size &lt; 10 -&gt; do_smaller().
  </code></pre>
  
  <p>I decided to look at its implementation in Haskell to see if this would help and I ended up getting even more confused.</p>
  
  <p>Is anyone able to point me at a tutorial (or explain to me) what the when statement is used for and how it's used in haskell and/ or erlang?</p>