title: If statements and && or ||
body: <p>OK so I'm a beginner with C# and I am having trouble understanding the if statement below.</p>
  
  <p>For this example INumber is declared as 8, dPrice is 0 and dTAX is 10.</p>
  
  <pre><code>        if (iNumber != 8 || iNumber != 9)
          {
              dPrice = dPrice + dTAX;
          }
  </code></pre>
  
  <p>Can somebody explain why it is entering the statement and adding the 10 from dTAX to dPrice?</p>
  
  <p>I know changing it to &amp;&amp; works, but why?</p>
  
  <p>As I understand it, it should only enter the If statement, if iNumber does not equal 8 or 9, which here it does, so it should not enter.</p>
  
  <p>Here are my outputs after running it through the || if statement.</p>
  
  <pre><code>        Inumber is: 8
  
          dPrice was: 0
          dPrice is now: 10
  
          dTAX is: 10
  </code></pre>
  
  <p>Can somebody please explain this to me?</p>