for


for (int icount = 2; icount <= 20; ivalue++) 
{
   break; //terminates the closest ending loop or switch
}

Using it with an array

string[] myArray = { "one", "two", "three" } 
for (int icount = 0; i < myArray.Length; icount++)
{
   Console.Write(myArray[icount]);
}


for (reverse)

for (icount = 20; icount > -1; ivalue--) 
{

}


Continue

The continue statement transfers execution to the next iteration within the loop

for (int icount = 2; icount <=10; icount++) 
{
   if (icount = 6) {
      continue;
   }
}


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext