unless
is the inverse operation of if
in Pug. It is analogous to if !(statement)
.
index.pug
- var likesCookies = true;
unless likesCookies === true
h2 You don't like cookies :(
else
h2 You like cookies!
index.pug output
<h1>You like cookies!</h1>
Note: else unless
statements do not work with unless
; you can chain an else if
statement to an unless
statement, but else unless
does not work.