C# – Loops by onlineteachinghub
In this video we will learn about 4 kinds of loops in C#:
For loop: Used to repeat actions until a limit is met
for(initialize; limit; increment){ // Do action here }
While loop: Used to repeat action until a condition is met
while( condition ){ // Do action here }
Do-while loop: Same as while loop but the “do” part runs first
do{ // Do action here }while( condition );
Foreach loop: Used on arrays
foreach ( var a in SomeArray ){ // Do action here }