Here is my 'if' statement in a loop. Sometimes the description will exist and sometimes it will not. But all I am getting is the word LIKE
and not ME
when the description actually exists.
{{ description }}
{{ if description }}
ME
{{ endif }}
LIKE
If
description
can be evaluated totrue
,{{ if description }}
may work.But to test if a variable actually exists (~ is not null), you can use the keyword
exists
, like this:{{ if exists description }}
.If you are not sure that
description
always exists, you should also put it inside the 'if' scope, like that:Take a look at these links of documentation: