Loops - For Each
The foreach loop is used to iterate over a collection of items.
int[] numbers = { 1, 2, 3, 4, 5 };
foreach (int number in numbers) {
}
The foreach loop is used to iterate over a collection of items, and execute a block of code for each item in the collection.
The variable number is assigned to each item in the collection in turn, and cannot be changed inside the loop.