Question: How can I go about doing this so if the "if" statement is true, to skip the code below the foreach loop and to go on with the rest of the program

```
void()
{
    foreach()
    {
        if()
        {

        }
    }

    //code I want to skip if "if" statement is true

}

```

Answer: 
There's no way to directly do what you want (without "goto" labels -- perish the thought!), but you can use the "break" keyword, and set a variable you can refer to later.

```
void()
{
    var testWasTrue = false;
    foreach()
    {
        if()
        {
            testWasTrue = true;
            break;  // break out of the "foreach"
        }
    }

    if( !testWasTrue ) {
        //code I want to skip if "if" statement is true
    }

}

```
Only way I know how is a bool flag.

```
void()
{
  bool x = false;
  foreach()
  {
    if()
    {
      x = true;
      break;
    }
  }
  if(!x)
  {
    //Code to skip if "if" statement is true.
  }
}

```

Not super elegant, but easy.
Edit: beat by 12 secs :)