Articles added in Mathematics Lab | Cyber Lab is now open | Astronomy Lab is now open | VLSI Lab is now open | 120 SEO Tips article published | More exciting articles coming soon!




Break statement

It can be used only inside looping structures (for, while, do-while) and with switch statement to terminate the structure in which break is used. That means because of break statement, the control will be transferred to immediate next statement of the structure in which break is used.

For e.g.
for (i=1;i<=22; i++)
{ ………
………
if (i>12)
break;
………
………
}
--> When break statement is written,control comes out of the loop.
//Next statement
Similarly in while and do-while.

Nested loop:

i)for (i=1;i<=10; i++)
{ ………
………
for (j=1;j<=20; j++)
{…………
if (j>5)
break;
………
………
}
……………….
………………
}

--> Remaining part of the loop is not executed whenever break statement is written







CACKLE comment system





Programming Resources
Computer Networking Fundamentals Android Application