# If-then statement causes syntax error when trying to publish

**URL:** <https://community.hubspot.com/t/if-then-statement-causes-syntax-error-when-trying-to-publish/2215>\
**Category:** CMS Development\
**Created:** [June 1, 2017, 3:16pm UTC](https://community.hubspot.com/t/if-then-statement-causes-syntax-error-when-trying-to-publish/2215 "2017-06-01T15:16:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![roy](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/roy/32/44779_2.png) [@roy](https://community.hubspot.com/u/roy)\
**Post date:** [June 1, 2017, 3:16pm UTC](https://community.hubspot.com/t/if-then-statement-causes-syntax-error-when-trying-to-publish/2215/1 "2017-06-01T15:16:59Z")

</div>

I’m getting this error when I try to publish a HubSpot webpage:

![image.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/2/241417d77b5e23a38ca597258908dcd2715dd70e.png)

I’m getting the error regardless of whether or not the “Make this template available for new content” box is checked, and I think it’s being caused by this code:

`{% if contact.accepts_medicare = "Yes" %}, including Medicare{% endif %}`

Someone from support pointed [this](http://designers.hubspot.com/docs/hubl/if-statements) out to me: **“Please note that using personalization variables (contact and company variables) within if statements is not currently supported for email in HubSpot. These variables can be used for logic on COS page and blog templates.”**

But it’s a webpage, not an email, so I don’t understand why that would be a problem.

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![roy](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/roy/32/44779_2.png) [@roy](https://community.hubspot.com/u/roy)\
**Post date:** [June 1, 2017, 3:28pm UTC](https://community.hubspot.com/t/if-then-statement-causes-syntax-error-when-trying-to-publish/2215/2 "2017-06-01T15:28:33Z")

</div>

The problem was that I was using “=” instead of “==”. Dumb mistake on my part.

---

<div class="post-metadata">

**Author:** ![stefen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stefen/32/29274_2.png) [@stefen](https://community.hubspot.com/u/stefen)\
**Post date:** [June 2, 2017, 6:00pm UTC](https://community.hubspot.com/t/if-then-statement-causes-syntax-error-when-trying-to-publish/2215/3 "2017-06-02T18:00:38Z")

</div>

@roy if it’s easier to remember, you could also use the expression equivalent: “is equalto”

---

<div class="post-metadata">

**Author:** ![roy](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/roy/32/44779_2.png) [@roy](https://community.hubspot.com/u/roy)\
**Post date:** [June 2, 2017, 6:05pm UTC](https://community.hubspot.com/t/if-then-statement-causes-syntax-error-when-trying-to-publish/2215/4 "2017-06-02T18:05:25Z")

</div>

Good to know! Thank you, Stefen!
