pug Conditionals Unless Operator


unless is the inverse operation of if in Pug. It is analogous to if !(statement).


- var likesCookies = true;
unless likesCookies === true
    h2 You don't like cookies :(
    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.