0
If you are using nested loops (i.e., one loop inside another loop), the break statement will stop the execution of the innermost
PLZZ someone explain me this by an eg
3 Answers
+ 2
If you add break statment inside inner loop then inner loop will stop its exicution
+ 1
Put this inside Main method and play around by commenting the `if` block
for(int i = 1; i < 6; i++)
{
for(int j = 1; j < 6; j++)
{
// without the `if` block, this was supposed to print
// 5 rows by 5 columns.
if(j == 4)
{
break;
}
Console.Write("{0} ", j);
}
Console.WriteLine();
}
+ 1
That means the outer loop still executes n only the only the execution of the inner loop is interferred