Author : MD TAREQ HASSAN | Updated : 2021/03/22
for loop
// for loop
for(var i = 1; i <= n; i++){
}
foreach loop
// foreach loop
// used to read item from IEnumerable / IEnumerable <T> (to manipulate items use for loop or iterator)
var items = new int[] { 1, 2, 3, 5, 8};
foreach (var item in items){
}
while loop
// while loop
while(node != null){
// ... ... ...
node = node.Next;
}
Break and continue
You can use break
and continue
inside loop