user55586: x = 5;
Serial.println (x);

if (x == 0);
    {
      //stuff in this IF keeps happening why ?
      //Iam too stupid ?
    }


user4143: You have a rogue semi-colon.
Splitting your code up on the end of statements you get:
1. x = 5; 
2. Serial.println (x);
3. if (x == 0);
4. { // stuff }

With the semi-colon after the if it terminates the if before the opening block {, and that block becomes a completely separate statement detached from the if.

55586: <pre><code>x = 5;
Serial.println (x);

if (x == 0);
    {
      //stuff in this IF keeps happening why ?
      //Iam too stupid ?
    }
</code></pre>
 4143: <p>You have a rogue semi-colon.</p>

<p>Splitting your code up on the end of statements you get:</p>

<pre><code>1. x = 5; 
2. Serial.println (x);
3. if (x == 0);
4. { // stuff }
</code></pre>

<p>With the semi-colon after the <code>if</code> it terminates the <code>if</code> before the opening block <code>{</code>, and that block becomes a completely separate statement detached from the <code>if</code>.</p>
