title: How do I elegantly check many conditions in Erlang?
body: <p>So when a user sends a request to register an account, they send their username, password, email, and other info. The registration function must verify all of their data. An example would be:</p>
  
  <ul>
  <li>verify email not in use</li>
  <li>verify username not in use</li>
  <li>verify username is alphanumeric</li>
  <li>verify all fields are above X characters long</li>
  <li>verify all fields are less than Y characters long</li>
  </ul>
  
  <p>Now I don't want to have a 5 level deep if or case statement, but what other options do I have? Splitting it into separate functions sounds like a good idea, but then I just have to check the return value of the functions in some sort of conditional and it's back to the original problem. </p>
  
  <p>I could separate them into functions and then call an if statement with all of the conditionals OR'd together, but that wouldn't give me what I want because I need to be able to tell the user the specific error if there was one.</p>
  
  <p>How does one handle this kind of situation in erlang? Is there an equivalent of a return statement, or does it have to be the last executable line in a function to be a return value?</p>