Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

how to check if a variable is not empty?

how to check if a variable is not empty in the volt?

this code

{% if resources['mensagem'] is not empty %}
// some code
{% endif %}

doesn't work.

I get this:

Undefined variable: empty

Thanks



83.2k
Accepted
answer

Try:

{% if !(resources['mensagem'] is empty) %}
// some code
{% endif %}
edited Aug '14

Thanks

solved!



6.1k

好东西