# Loop for a specified number of times

**URL:** https://community.silverfin.com/t/loop-for-a-specified-number-of-times/2284
**Category:** Templates
**Created:** [April 29, 2022, 10:40am UTC](https://community.silverfin.com/t/loop-for-a-specified-number-of-times/2284 "2022-04-29T10:40:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jhanley](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jhanley](https://community.silverfin.com/u/jhanley)
#### Post date: [April 29, 2022, 10:40am UTC](https://community.silverfin.com/t/loop-for-a-specified-number-of-times/2284/1 "2022-04-29T10:40:38Z")

</div>

Hi,

Is it possible to loop through a piece of code a specified number of times, based on an input value? i.e. if we wanted to simply repeat `hello world` based on a number entered into `custom.some.thing`:

```auto
{% input custom.some.thing placeholder:"Input value" as:"integer" %}
hello world

```

When `custom.some.thing` = 2, then…

```auto
hello world
hello world

```

…and so forth?

Many thanks  
Joe

---

<div class="post-metadata">

### Author: ![Jelena\_Sutova](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/jelena_sutova/32/599_2.png) [@Jelena\_Sutova](https://community.silverfin.com/u/Jelena_Sutova)
#### Post date: [May 4, 2022, 3:09pm UTC](https://community.silverfin.com/t/loop-for-a-specified-number-of-times/2284/2 "2022-05-04T15:09:42Z")

</div>

@jhanley

Thank you for your question.  
You can try with below code:

```auto
{% input custom.some.thing placeholder:"Input value" as:"integer" %}

{% if custom.some.thing != blank %}
  {% for item in (1..custom.some.thing) %}
    Hello world
  {% endfor %}
{% endif %}

```

If you are interested, you can find more information here

> **[Iterations](https://developer.silverfin.com/docs/iterations#helper-variables)**
>
> The iteration tag allows code to be executed repeatedly.

---

<div class="post-metadata">

### Author: ![jhanley](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jhanley](https://community.silverfin.com/u/jhanley)
#### Post date: [May 5, 2022, 10:29am UTC](https://community.silverfin.com/t/loop-for-a-specified-number-of-times/2284/3 "2022-05-05T10:29:28Z")

</div>

Hi @Jelena_Sutova,

Thanks for sharing your insight + resource. This has helped me further develop my code and provided a solution to my original query!

Kind regards  
Joe
