# How To Do A For Loop In Elixir (using only recursion)

**URL:** <https://forum.elixirforum.com/t/how-to-do-a-for-loop-in-elixir-using-only-recursion/595>\
**Category:** Discussions\
**Tags:** recursion, code-snippets\
**Created:** [May 13, 2016, 1:18pm UTC](https://forum.elixirforum.com/t/how-to-do-a-for-loop-in-elixir-using-only-recursion/595 "2016-05-13T13:18:56Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![sztosz](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sztosz/32/1251_2.png) [@sztosz](https://forum.elixirforum.com/u/sztosz)\
**Post date:** [May 14, 2016, 2:11pm UTC](https://forum.elixirforum.com/t/how-to-do-a-for-loop-in-elixir-using-only-recursion/595/21 "2016-05-14T14:11:44Z")

</div>

Wise words from Programming Elixir by Dave Thomas

> L. Peter Deutsch once penned, “To iterate is human, to recurse divine.” And  
> that’s certainly the way I felt when I first started coding Elixir. The joy of  
> pattern-matching lists in sets of recursive functions drove my designs. After  
> a while, I realized that perhaps I was taking this too far.  
> In reality, most of our day-to-day work is better handled using the various  
> enumerators built into Elixir. They make your code smaller, easier to understand,  
> and probably more efficient.  
> Part of the process of learning to be effective in Elixir is working out for  
> yourself when to use recursion and when to use enumerators. I recommend  
> enumerating when you can.

---

_[View the full topic](https://forum.elixirforum.com/t/how-to-do-a-for-loop-in-elixir-using-only-recursion/595)._
