I'm new to Twig, and I'm struggling to compare a value from a checkbox with a value from a drop-down
{# sourceCountry - checkbox with a list of countries #}
{# currentUser.country - dropdown with a list of countries #}
{% for sourceCountry in region.targetCountries %}
{{ sourceCountry }} = {{ currentUser.country }} <br>
{{ dump(sourceCountry == currentUser.country) }}
{% if sourceCountry == currentUser.country %}
{% set visibility = true %}
{% endif %}
{% endfor %}
The result I'm getting from this is:
GB = GB
bool(false)
Most likely something to do with variable types, but no idea how to solve this. I've searched for some Twig 'to string' conversions, but no luck.