Testing if something is not true

Ever wonder how to check if something isn’t true like {{#if NOT [“Plugin”].[$success]}} ?

Handlebars does this using {{#unless [“Plugin”].[$success]}}

Here is an example of an array using unless so you don’t duplicate line breaks (it also shows how to get the first or last iteration of an array and how to write output if the array was empty)

---
{{#each ["Loop Through Array"].[$outputs]}}
{{#unless @first}}
---
{{/unless}}
{{["Loop Through  Array"].[$item]}}
{{#unless @last}}
---
{{/unless}}
{{else}}
Array was empty
{{/each}}
---
3 Likes