title: C# skip rest of if statement if inner if is true
body: <p>my code is as follows:</p>
  
  <pre><code>public void Method()
  {
      if (flagIsUp)
      {
           if (x = 1)
              code here;
  
           if (y = 2)
              code here;
  
           if (z = 3)
              code here;
      }
  
      if (buttonPressed)
      {
           code here;
      }
  
  }
  </code></pre>
  
  <p>What do I put under if (y = 2) so that if its TRUE, it'll skip to the rest of of the "if (flagIsUp)" block (i.e. it will skip the "if (z = 3)" statement), and continue with the method (i.e. moving on to "if (buttonPressed)"? I tried break;, but that requires a loop. Using return; simply ends Method(), skipping through the rest of the code, which is not my intention.</p>