variable inside for loop is empty outside the loop I need to set a bunch of variables to feed my html head metas. Most of the time the page is directly related to an entry but i also have pages for each user with a route that look like 'equipe/user.username':

{% if craft.request.getSegment(1) == 'equipe' and craft.request.getSegment(2) is defined %}
    {% set user = craft.users.username(craft.request.segment(2)).first()%}
    {% set title = user.username %}
    {% set description = user.description %}
    {% set resume = user.resume %}
    {% set url = siteUrl~'equipe/'~user.username %}
    {% for asset in user.imageHeader %}
        {% set imageUrl = asset.getUrl('header') %}
        {{ imageUrl }}
    {% endfor %}
{% else %}
    {% set title = entry.title %}
    {% set description = entry.description %}
    {% set resume = entry.resume %}
    {% set url = entry.url %}
    {% for asset in entry.imageHeader %}
        {% set imageUrl = asset.getUrl('header') %}
        {{ imageUrl }}
    {% endfor %}
{% endif %}
{{ imageUrl }}


Everything works fine except for the imageUrl variable. it behave like a local variable. I can retrieve the value just after it is set, but not outside of the for loop... any idea why ?
I found the solution to the issue... indeed it behave like a local variable ! if i want to use it outside of the for loop it seems that i have to set it before with something like: 

{% set imageUrl = '' %}