pub fn default(value: &Value, other: Option<Value>, lax: Option<bool>) -> Value
Expand description
If the value is undefined it will return the passed default value, otherwise the value of the variable:
<p>{{ my_variable|default("my_variable was not defined") }}</p>
Setting the optional second parameter to true
will also treat falsy
values as undefined, e.g. empty strings:
<p>{{ ""|default("string was empty", true) }}</p>