This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

# Increment loop for more than 1 in volt

Could you please tell me how i do like this in volt ?

``````\$x = 13;
for(\$i = 0; \$i < \$x ; \$i = \$i + 3) {
echo '<div>';
echo \$i <= \$x ? \$i : '';
echo \$i <= \$x - 1 ? (\$i + 1) : '';
echo \$i <= \$x - 2 ? (\$i + 2) : '';
echo '<hr><div>';
}``````

Thanks all pro so much 950

Can you check this if this will help you, its the same concept

https://stackoverflow.com/questions/21921126/numeric-loop-in-volt 93.4k
Accepted

As @devninja86 suggested you will have to use the `range` operator `..`, but unfortunately it does not support the step parameter, which you need (at least I can't find a way to add it). Here is a solution, let's see if someone has better ideas :)

``````{% set x = 13 %}
{% set step = 3 %}
{% for i in range(0, x, step) %}
<div>
{{ i <= x ? i : '' }}
{{ i <= x - 1 ? i + 1 : '' }}
{{ i <= x - 2 ? i + 2 : '' }}
<hr>
</div>
{% endfor %}``````

NOTE: For `range` PHP function to be available in Volt, you have to add it in your service definition:

``\$compiler->addFunction('range', 'range');`` 9.5k

@devninja86 my problem is

``\$i = \$i + 3``

@Nikolay-Mihaylov range is a good idea.