# Checking for multiple values in an if statement

**URL:** <https://community.hubspot.com/t/checking-for-multiple-values-in-an-if-statement/22113>\
**Category:** CMS Development\
**Created:** [June 25, 2020, 4:45pm UTC](https://community.hubspot.com/t/checking-for-multiple-values-in-an-if-statement/22113 "2020-06-25T16:45:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DM2](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dm2/32/39641_2.png) [@DM2](https://community.hubspot.com/u/DM2)\
**Post date:** [June 25, 2020, 4:45pm UTC](https://community.hubspot.com/t/checking-for-multiple-values-in-an-if-statement/22113/1 "2020-06-25T16:45:55Z")

</div>

Hi

A basic hubl question…I want to check to see if a variable is one of several different values. In the sample below I’m looking to see if my\_variable is equal to any of the 5 values listed.

Can anyone tell me why this doesn’t work please:

```auto
{% if my_variable == ('string1', 'string2', 'string3', 'string4', 'string5') %}

Do something

{% endif %}

```

Appreciate any help, thank you.

---

<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 25, 2020, 5:09pm UTC](https://community.hubspot.com/t/checking-for-multiple-values-in-an-if-statement/22113/2 "2020-06-25T17:09:08Z")

</div>

@DM2 a sequence should use square brackets e.g. [‘string1’,'string2]

Using the “is containing” expression you should be able to do what you’re looking for. Here’s how it works:

```auto
{% if [1, 2, 3, 4] is containing my_variable %}
 variable is in sequence
{% endif %}

```

more info here: [https://developers.hubspot.com/docs/cms/hubl/operators-and-expression-tests#expression-tests](https://developers.hubspot.com/docs/cms/hubl/operators-and-expression-tests#expression-tests)

---

<div class="post-metadata">

**Author:** ![DM2](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dm2/32/39641_2.png) [@DM2](https://community.hubspot.com/u/DM2)\
**Post date:** [June 26, 2020, 1:02pm UTC](https://community.hubspot.com/t/checking-for-multiple-values-in-an-if-statement/22113/3 "2020-06-26T13:02:10Z")

</div>

Thanks Stefen that worked perfectly first time!
