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

Code Example 1

for (int i = 0; i < 10; i++)
{
    Console.WriteLine("Value of i: {0}", i);
}

Code Example 2

for (int i = 0; i < 5; i++)
{
    Console.WriteLine(i);
}

Code Example 3

for (int i = 0; i < 2; i++)
{
    for(int j =i; j < 4; j++)
        Console.WriteLine("Value of i: {0}, J: {1} ", i,j);
}

Code Example 4

//You can use variables for this as well but im a stupid kid so no.
float kills = 10f
while(kills < 0)
{
  Debug.Log("Kids Rule bwahahahhaha")
}

Code Example 5

// ------------------- Syntax of Loops ---------------------- //

// ----- FOR LOOP ----- //
// for (start value; condition; increment)

 for (int i = 0; i < 10; i++) {
  
    Console.WriteLine(i);
 }


// ----- WHILE LOOP ----- //
// start_value = 0; while (condition) { increment++ }

 int counter = 0;

 while (counter < 5) {
    
   Console.WriteLine(counter);
   counter++;
 }


// ----- DO WHILE LOOP ----- //
// start_value = 0; do { increment++ } while (condition);

 int counter = 0;

 do
 {
   Console.WriteLine(counter);
   counter++;
   
  } while (counter < 5);


// ----- FOREACH LOOP ----- //
// for (item in list/array)

 string[] myArray = { "grape", "orange", "pink", "blue" };

 foreach (string item in myArray) {
    
   Console.WriteLine(item);
 }

Learn ReactJs, React Native from akashmittal.com