title: Removing a value from a custom linked list
body: <pre><code>int SDI::LinkedList::removeValue(int removeValue)
  {
  SDI::Node* current = head;
  SDI::Node* prev = head; 
      while (current != nullptr)
      {
          if (current == head)
          {
              if (current-&gt;value == removeValue)
              {
                  current = current-&gt;next; // track the next value
                  delete head;
                  head = current-&gt; next;
                  return 1;
              }       
  
          }
          else
          {
              if (current-&gt;value != removeValue)
              {
                  prev = current;  /// don’t lose track of the previous value, saves working 1 ahead
                  current  = current-&gt; next; // let the loop deal with it
  
              }
          else
          {
              prev-&gt;next = current-&gt;next;
              delete current;
          }
              if (current-&gt;next != nullptr)
              {
                  if (current-&gt;next-&gt;value == removeValue)
                  {
                  SDI::Node* temp = current-&gt;next;
                  current-&gt;next = current-&gt;next-&gt;next;
                  delete temp;
                  return 1;
                  }
              }
          }
      }
  return 0;
  }
  </code></pre>
  
  <p>All seems to work well, until it reaches the line:</p>
  
  <pre><code>"if (current-&gt;value != removeValue)"
  </code></pre>
  
  <p>It seems to just jump directly over it, yet current-> value DOES NOT equal removeValue as shown in the watcher.</p>