title: I don't understand why this code works?
body: <p>The method in the class accepts an integer from a user to remove from the list. The code works. The problem I have is that I don't understand why it works; indeed, from what I know, it <em>shouldn't</em> work. </p>
  
  <pre><code>public void Remove(int ValueToRemove)
      {
          bool isFound = false;
          for (int count = 0; count &lt; CurrentIndex; count++)
          {
              if (list[count] == ValueToRemove &amp;&amp; !isFound)
              {
                  isFound = true;
                  CurrentIndex = CurrentIndex -1;
              }
  
              if (isFound &amp;&amp; ((count + 1) &lt; list.Length))
              {
                  list[count] = list[count + 1];
              }
          }
  
      }
  </code></pre>
  
  <p>Shouldn't the statement...</p>
  
  <pre><code>if(list[count] == ValueToRemove &amp;&amp; !isFound)
  </code></pre>
  
  <p>...always evaluate as false, therefore skip running the code inside the braces? Isn't !isFound the equivalent of evaluating</p>
  
  <pre><code>if(list[count] == ValueToRemove &amp;&amp; isFound == true)
  </code></pre>
  
  <p>In the code...</p>
  
  <pre><code>if (list[count] == ValueToRemove &amp;&amp; !isFound)
              {
                  isFound = true;
                  CurrentIndex = CurrentIndex -1;
              }
  </code></pre>
  
  <p>...if CurrentIndex = CurrentIndex - 1, making CurrentIndex equal one less than what it did, what happens to the previous index? </p>
  
  <p>Lastly...</p>
  
  <pre><code>if (isFound &amp;&amp; ((count + 1) &lt; list.Length))
              {
                  list[count] = list[count + 1];
              }
  </code></pre>
  
  <p>...does the value of list[count] equal the value of the next index (ex. index 5 equals whatever value was in index 6), or does the value contained within that index equal one higher (ex. if index 5 contains the value of 10, then index 5 will now equal 11)</p>