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: 
The 'break' keyword will break out of the loop.

```
foreach (someClass a in someArray) 
{
  if(a.someProperty) // bool property 
  {
    //Stuff to do if that condition is true
    doSomethingElse();
    //Calling the break keyword will stop the loop and jump immediately outside of it
    break;
  }
  //Other code to run for each iteration of the loop
}

//Here is where execution will pick up either after break is called or after the loop finishes

```
```
void() 
{ 
    bool skip = false;
    foreach() 
    { 
        if() 
        { 
           skip = true;
        } 
    } 

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

```