Drop-down and checkbox in a condition 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 }}   &lt;br&gt;
      {{ 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.
A checkboxes field returns an array of models, that you can inspect using {{ dump(sourceCountry) }} in your loop.

The model has a __toString method that outputs the checkbox value when you output the model using {{ sourceCountry }}. This magic method doesn’t do its thing when you use the model in a comparison operator, so you are currently comparing a model to a string.

Access the value property directly and your conditional should work.

{% if sourceCountry.value == 'GB' %} 
    {% set visibility = true %}
{% endif %}