In my this blog we will see some basic syntex of loops .

what is the meaning of nesting loops?

Nesting behavior refers to loops within loops. means using a loop within an another loop.

Let’s understand it with help of some synnex.

Nesting loop syntex for for loop :-

for ( initialize ; condition ; expressions )
{
   // this for loop is within a for loop so this is 
   //nesting of for loops
for ( initialize ; condition ; expressions )
  {
     statement(s);
  }
 statement(s);
}

Nesting loop syntex for for loop :-

while ( condition )
{
   // this while loop is within a while loop so this is 
  //nesting of while loops
 whlie ( condition )
   {
      statement(s);
   }
 statement(s);
}

Nesting loop syntex for for loop :-

do
{
   // this do-while loop is within a do-while loop so this is 
  //nesting of do-while loops
 do
  {
     statement(s);
  }while ( condition );
 statement(s);
}while ( condition );

loops within loop is called nesting of loops.