The following code segment depicts the great variety of ways in which program flow can be re-routed in C#, including if-else structures, while loops, and for/foreach loops.

if (i < 10)
{
  // go here if i is less than 10
}
else
{
  // go here otherwise
}
while(i < 10)
{
  // keep looping through here as long as i is less than 10
}
for(int i = 0; i < 10; i++)
{
    // loop 10 times
}
foreach(MyClass mc in myCollection)
{
  // ... execute once for each mc object in myCollection
}