{"_id":"5937b2388e8d9b002f1df29d","category":{"_id":"5937b2388e8d9b002f1df272","version":"5937b2378e8d9b002f1df26e","project":"542fe92a5eceb608003fddc8","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-04T12:45:40.548Z","from_sync":false,"order":3,"slug":"helper-reference","title":"Helper Reference"},"parentDoc":null,"project":"542fe92a5eceb608003fddc8","user":"542c5cfcddd3190e00228849","version":{"_id":"5937b2378e8d9b002f1df26e","project":"542fe92a5eceb608003fddc8","__v":1,"createdAt":"2017-06-07T07:58:47.936Z","releaseDate":"2017-06-07T07:58:47.936Z","categories":["5937b2388e8d9b002f1df26f","5937b2388e8d9b002f1df270","5937b2388e8d9b002f1df271","5937b2388e8d9b002f1df272","5937b2388e8d9b002f1df273","5937b2388e8d9b002f1df274"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-04-07T20:12:26.060Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":53,"body":"Usage: `{{#unless featured}}{{/unless}}`\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"[Block](/docs/helpers#section-block), [Handlebars](/docs/helpers#section-handlebars)\",\n    \"h-0\": \"Type\",\n    \"h-1\": \"Parameters\",\n    \"h-2\": \"Attributes\",\n    \"0-1\": \"conditional value (any type)\",\n    \"0-2\": \"n/a\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\nThe `{{#unless}}` block helper comes built in with Handlebars.\n\n### Description\n\n`{{#unless}}` is essentially the opposite of `{{#if}}`. If you want to test a negative conditional only, i.e. if you only need the `{{else}}` part of an `{{#if}}` statement, then `{{#unless}}` is what you need.\n\nIt works exactly the same as `{{#if}}` and supports both `{{else}}` and `^` negation if you want to get really confusing!\n\nUnless also uses the exact same conditional evaluation rules as [`{{#if}}`](/docs/helpers/if).\n\n### Example code\n\nBasic unless example, will execute the template between its start and end tags only if `featured` evaluates to false.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{{#unless featured}}\\n  ...do something...\\n{{/unless}}\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nIf you want, you can also include an else block, although in the majority of cases, if you need an else, then using `{{#if}}` is more readable:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// This is identical to if, but with the blocks reversed\\n{{#unless featured}}\\n  ...do thing 1...\\n{{else}}\\n  ...do thing 2...\\n{{/unless}}\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nAll block helpers also support negation, but now you really *should* be using if!!\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// The negation symbol means that this is identical to using if\\n{{^unless featured}}\\n  ...do thing 1...\\n{{else}}\\n  ...do thing 2...\\n{{/unless}}\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]","excerpt":"`{{unless}}` Helper - reverse conditional helper (else block)","slug":"unless","type":"basic","title":"unless"}

unless

`{{unless}}` Helper - reverse conditional helper (else block)

Usage: `{{#unless featured}}{{/unless}}` [block:parameters] { "data": { "0-0": "[Block](/docs/helpers#section-block), [Handlebars](/docs/helpers#section-handlebars)", "h-0": "Type", "h-1": "Parameters", "h-2": "Attributes", "0-1": "conditional value (any type)", "0-2": "n/a" }, "cols": 3, "rows": 1 } [/block] The `{{#unless}}` block helper comes built in with Handlebars. ### Description `{{#unless}}` is essentially the opposite of `{{#if}}`. If you want to test a negative conditional only, i.e. if you only need the `{{else}}` part of an `{{#if}}` statement, then `{{#unless}}` is what you need. It works exactly the same as `{{#if}}` and supports both `{{else}}` and `^` negation if you want to get really confusing! Unless also uses the exact same conditional evaluation rules as [`{{#if}}`](/docs/helpers/if). ### Example code Basic unless example, will execute the template between its start and end tags only if `featured` evaluates to false. [block:code] { "codes": [ { "code": "{{#unless featured}}\n ...do something...\n{{/unless}}", "language": "html" } ] } [/block] If you want, you can also include an else block, although in the majority of cases, if you need an else, then using `{{#if}}` is more readable: [block:code] { "codes": [ { "code": "// This is identical to if, but with the blocks reversed\n{{#unless featured}}\n ...do thing 1...\n{{else}}\n ...do thing 2...\n{{/unless}}", "language": "html" } ] } [/block] All block helpers also support negation, but now you really *should* be using if!! [block:code] { "codes": [ { "code": "// The negation symbol means that this is identical to using if\n{{^unless featured}}\n ...do thing 1...\n{{else}}\n ...do thing 2...\n{{/unless}}", "language": "text" } ] } [/block]