Check out example codes for "c# exit for". It will help you in understanding the concepts better.

Code Example 1

Use "break;"
  
for (int i = 1; i <= 100; i++)
{
	if (i == 5)
	{
		break;
	}
}

Code Example 2

while (playerIsAlive) 
{ 
// this code will keep running
  if (playerIsAlive == false) 
  { 
    // eventually if this stopping condition is true, 
    // it will break out of the while loop
    break; 
   } 
 } 

// rest of the program will continue

Learn ReactJs, React Native from akashmittal.com