# 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:** 5

<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 13, 2016, 4:21pm UTC](https://forum.elixirforum.com/t/how-to-do-a-for-loop-in-elixir-using-only-recursion/595/5 "2016-05-13T16:21:38Z")

</div>

That blog entry is irrelevant 😉 Do you really consider your solution to be simplest?

`ForLoop.for_loop(10,&(IO.puts(&1)))`  
`Enum.each(0..10, &(IO.puts(&1)))`  
`for x <- 0..10, do: IO.puts x`

Try to look at this code like had no knowledge about programming whatsoever, and answer yourself this: Which line describes what is going to happen when you run it best?

There was some passive aggressive PS. here. And it was uncalled for.

---

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