title: Erlang Recursive end loop
body: <p>I just started learning Erlang and since I found out there is no for loop I tried recreating one with recursion:</p>
  
  <pre><code>display(Rooms, In) -&gt;
      Room = array:get(In, Rooms)
      io:format("~w", [Room]),
      if
          In &lt; 59 -&gt; display(Rooms, In + 1);
          true -&gt; true
      end.
  </code></pre>
  
  <p>With this code i need to display the content (false or true) of each array in Rooms till the number 59 is reached. However this creates a weird code which displays all of Rooms contents about 60 times (?). When I drop the if statement and only put in the recursive code it is working except for a exception error: Bad Argument.</p>
  
  <p>So basically my question is how do I put a proper end to my "for loop".</p>
  
  <p>Thanks in advance!</p>