# How to create cycle function in elixir

**URL:** <https://forum.elixirforum.com/t/how-to-create-cycle-function-in-elixir/16062>\
**Category:** Questions\
**Tags:** cycle\
**Created:** [August 24, 2018, 12:15pm UTC](https://forum.elixirforum.com/t/how-to-create-cycle-function-in-elixir/16062 "2018-08-24T12:15:46Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![shahryarjb](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shahryarjb/32/39485_2.png) [@shahryarjb](https://forum.elixirforum.com/u/shahryarjb)\
**Post date:** [August 24, 2018, 12:26pm UTC](https://forum.elixirforum.com/t/how-to-create-cycle-function-in-elixir/16062/3 "2018-08-24T12:26:09Z")

</div>

Thank you, I have 2 questions:

1. how do I use this in my code, I need it to be printed a number in my code each loop, like this:

- the\_number\_which\_I\_need = 1
- the\_number\_which\_I\_need = 2
- the\_number\_which\_I\_need = 3
- the\_number\_which\_I\_need = 4
- the\_number\_which\_I\_need = 1

```elixir
<%= for el <- posts_entries do %>
    <%= el["title"] %>
   <%= the_number_which_I_need %>
<% end %>

```

1. is there a way to create this in a function?

---

_[View the full topic](https://forum.elixirforum.com/t/how-to-create-cycle-function-in-elixir/16062)._
