numeric loop in volt

Stefan Luv picture Stefan Luv · Feb 20, 2014 · Viewed 8.3k times · Source

I have read the volt documentation in phalcon page and i cant find any example for this...

You can make easy loops in objects, for example, in php:

foreach($pages as $page){
    echo $page->title;
} 

in volts would be ...

{% for page in pages %}
    {{ page.title }}
{% endfor %}

My question is, how i can make a normal numerical loop in volt? For example:

for($n=1;$n<10;$n++){
    echo $n;
}

Thanks.

Answer

redshark1802 picture redshark1802 · Feb 20, 2014

This will count from 1 to 10

{% for i in 1..10 %}
    {{ i }}
{% endfor %}