Checking for multiple values in an if statement

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:

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

Do something

{% endif %}

Appreciate any help, thank you.

@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:

{% 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

Thanks Stefen that worked perfectly first time!