fabpot/Twig — Issue #497: Check if variable is not defined?
Author: Zakay
Created: 2011-11-03 14:09:12+00:00
State: open

I am trying to check if variable is not defined, but can't seem to find a way that works
Here are some examples but none of them works.

```
{% for i in [4,5,1,2,9] %}
{% if min is not defined or min < i %}
{% set min = i %}
{% endif %}
{% endfor %}
Min: {{ min }}

{% for i in [4,5,1,2,9] %}
{% if not min is defined or min < i %}
{% set min = i %}
{% endif %}
{% endfor %}
Min: {{ min }}

{% for i in [4,5,1,2,9] %}
{% if not(min is defined) or min < i %}
{% set min = i %}
{% endif %}
{% endfor %}
Min: {{ min }}
```