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

Code Example 1

// To forcibly exit a while loop use 'break'
while (true)
{
	// Do something
  
	if (conditional)
    {
    	break;
  	}
}

Learn ReactJs, React Native from akashmittal.com