Symfony/Twig: Stop rendering the rest of a template
<p>I've been searching the internet for this, but I can't find anything regarding this.</p>

<p>I'm creating a simple twig template that is going to be used on multiple locations, but requires some variables.</p>

<p>I want to be able to do something like this:</p>

<pre><code>{% if some_variable is not defined %}
    &lt;h1&gt;Some variable was not defined.&lt;h1&gt;
    -- stop rendering the rest of the template --
{% endif %}

{{ some_variable }} is defined here.
</code></pre>

<p>The reason I'm asking this is really simple.
I don't want my entire template to be indented in one or more <code>if</code>-statements, since it'll clutter the entire file very easy.</p>

<p>I know the workaround would be to create multiple templates, but multiple files for a simple condition sounds kind of overkill to me.</p>

<p>If this doesn't exist natively, I'm okay creating an extension for this if anyone can tell me how- and if this can be achieved.</p>

<p>Thanks in advance!</p>

<p>P.S. Don't answer with <code>{% else %}</code>, thats exactly the thing I'm trying to avoid here...</p>