Conditionals
Pug’s first-class conditional syntax allows for optional parentheses.
If you’re coming from Pug v1, you may now omit the leading -
. Otherwise, it’s identical (just regular JavaScript):
Pug also provides the conditional unless
, which works like a negated if
. The following are equivalent:
unless user.isAnonymous
p You're logged in as #{user.name}
if !user.isAnonymous
p You're logged in as #{user.name}