DEV Community

Discussion on: Which types of loops are most popular in the programming languages you use?

Collapse
 
programazing profile image
Christopher C. Johnson • Edited

I generally work with collections in C# so I use ForEach loops a lot.

var numbers = new List<int>() { 1, 2, 3, 4 };

foreach (var number in numbers)
{
    Console.WriteLine(number + 1);
}