<p>You <em>can't</em> execute multiple statements inside of a single <code>{% %}</code> block.</p>
<p>You <em>can</em> have a single statement that is multi-line.</p>
<p>See here for more info: <a href="https://stackoverflow.com/questions/31111516/does-twig-support-executing-multiple-statements-inside-a-single-block">https://stackoverflow.com/questions/31111516/does-twig-support-executing-multiple-statements-inside-a-single-block</a></p>

CC BY-SA 4.0
2020-11-10T03:36:36.500Z
2020-11-10T03:36:36.500Z
Brad Bell
<p>Instead of using:</p>
<pre><code>{% ... %}
{% ... %}
{% ... %} 
</code></pre>
<p>For each line, i'd like to know if there is a way to do something like:</p>
<pre><code>{%

...
...
...

%}
</code></pre>

<templating>
Is there any way to code multiple lines in a twig file?
# Is there any way to code multiple lines in a twig file?

(Asked by: username_0 on 2020-11-09)

Instead of using:
{% ... %}
{% ... %}
{% ... %} 

For each line, i'd like to know if there is a way to do something like:
{%

...
...
...

%}

**Tags:** templating


---

## 1 answers

### Answer by username_1 on 2020-11-10. Score: 2

You *can't* execute multiple statements inside of a single `{% %}` block.

You *can* have a single statement that is multi-line.

See here for more info: <https://stackoverflow.com/questions/31111516/does-twig-support-executing-multiple-statements-inside-a-single-block>


---

