<p>It seems like you want to set offset to false after your first section.</p>

<p>To do this correctly you would need to use set like this:</p>

<pre><code>{% set offset = false %}
</code></pre>

<p><a href="http://twig.sensiolabs.org/doc/tags/set.html" rel="nofollow">Checkout the documentation to set a variable</a></p>

CC BY-SA 3.0
2016-04-06T13:04:27.460Z
2016-04-06T13:04:27.460Z
Marco Schuler
<p>The problem line is this one:</p>

<pre><code>{% offset = true %}
</code></pre>

<p>It needs to be:</p>

<pre><code>{% set offset = true %}
</code></pre>

<p>I think there are a couple of occurrences.</p>

CC BY-SA 3.0
2016-04-06T14:22:47.687Z
Sorry, I've just realised that the answer above says the same thing. Mark his as the correct answer if you agree.
Jamie Pittock
CC BY-SA 3.0
2016-04-06T14:34:07.340Z
Thanks, yes there were two occurrences thank you
Ross
CC BY-SA 3.0
2016-04-06T14:13:15.513Z
2016-04-06T14:13:15.513Z
Jamie Pittock
<p>Sorry if this is a really obvious question, I'm new to Twig and Craft. I'm getting the following error: 
Unexpected tag name "offset" (expecting closing tag for the "if" tag defined near line 54)</p>

<p>Can anyone tell me what is wrong with my code?</p>

<pre><code>&lt;div class="box alt container"&gt;
{% set offset = true %}
{% if offset %}
&lt;section class="feature left"&gt;
    {% set caseHero = entry.heroImage.first() %}
    &lt;a href="#" class="image icon fa-signal"&gt;&lt;img src='{{caseHero.url}}' alt="" /&gt;&lt;/a&gt;
    &lt;div class="content"&gt;
        &lt;h3&gt;{{entry.title}}&lt;/h3&gt;
        &lt;p&gt;{{entry.description}}&lt;/p&gt;
    &lt;/div&gt;
&lt;/section&gt;
    {% offset = false %}
{% else %}
&lt;section class="feature left"&gt;
    {% set caseHero = entry.heroImage.first() %}
    &lt;a href="#" class="image icon fa-signal"&gt;&lt;img src='{{caseHero.url}}' alt="" /&gt;&lt;/a&gt;
    &lt;div class="content"&gt;
        &lt;h3&gt;{{entry.title}}&lt;/h3&gt;
        &lt;p&gt;{{entry.description}}&lt;/p&gt;
    &lt;/div&gt;
&lt;/section&gt;
    {% offset = true %}
{% endif %}
</code></pre>

<p></p>

<templating>
Twig Templating If statement (Unexpected tag name error)
# Twig Templating If statement (Unexpected tag name error)

(Asked by: username_0 on 2016-04-06)

Sorry if this is a really obvious question, I'm new to Twig and Craft. I'm getting the following error: 
Unexpected tag name "offset" (expecting closing tag for the "if" tag defined near line 54)
Can anyone tell me what is wrong with my code?

{% set offset = true %}
{% if offset %}

    {% set caseHero = entry.heroImage.first() %}
    
    
        {{entry.title}}
        {{entry.description}}
    

    {% offset = false %}
{% else %}

    {% set caseHero = entry.heroImage.first() %}
    
    
        {{entry.title}}
        {{entry.description}}
    

    {% offset = true %}
{% endif %}

**Tags:** templating


---

## 2 answers

### Answer by username_1 on 2016-04-06. Score: 2 | Accepted answer

It seems like you want to set offset to false after your first section.
To do this correctly you would need to use set like this:
{% set offset = false %}

Checkout the documentation to set a variable


---

### Answer by username_2 on 2016-04-06. Score: 1

The problem line is this one:
{% offset = true %}

It needs to be:
{% set offset = true %}

I think there are a couple of occurrences.

> **Comments:**
> **username_2**: Sorry, I've just realised that the answer above says the same thing. Mark his as the correct answer if you agree.  
> **username_0**: Thanks, yes there were two occurrences thank you  

---

