title: if else inside a loop in pug
body: <p>
  This is a follow-up question to <a href="https://stackoverflow.com/questions/47604403/create-variables-inside-an-each-loop-in-a-pug-template/47606194#47606194">Create variables inside an each loop in a pug template</a></p>
  
  <p>I have a problem with a simple if else inside a loop in pug.
  This is my code:</p>
  
  <pre><code> extends layout
   block content
   h2 #{item}
   each word, index in words
    - var spelling = word.orth;
    if(item == spelling)
     p #{spelling}
    else
     p does not exist yet
  </code></pre>
  
  <p>The problem is if a word exists, it prints it out correctly <strong>but it also prints</strong> <em>does not exist yet</em> with it. And if a word does not exist, it prints out <em>does not exist yet</em>  <strong>3 times</strong> (That's the number of words I have in the xml file I am searching, see below).</p>
  
  <p>Background: I am searching through an xml file for words. The variable <em>item</em> is the user input, the word we are looking for in the xml file. </p>