extends ../reference.jade

block documentation
  h2 Conditionals

  p Jade's first-class conditional syntax allows for optional parenthesis, and you may now omit the leading <code>-</code> otherwise it's identical, still just regular javascript:

  .row(data-control='interactive')
    .col-lg-6
      +jade
        :jadesrc
          - var user = { description: 'foo bar baz' }
          - var authorised = false
          #user
            if user.description
              h2 Description
              p.description= user.description
            else if authorised
              h2 Description
              p.description.
                User has no description,
                why not add one...
            else
              h1 Description
              p.description User has no description
    .col-lg-6
      +html
        :htmlsrc
          <div id="user">
            <h2>Description</h2>
            <p class="description">foo bar baz</p>
          </div>

  p Jade also provides a negated version <code>unless</code> (the following are therefore equivalent):

  .row
    .col-lg-6
      +jade
        :jadesrc
          unless user.isAnonymous
            p You're logged in as \#{user.name}
    .col-lg-6
      +jade
        :jadesrc
          if !user.isAnonymous
            p You're logged in as \#{user.name}
