Arrays and Loops in C#
Arrays hold many values of the same type under one name, and loops repeat work for each of them. You will create and read arrays, then loop with while, do-while, for, and foreach.
Updated
Arrays in C#
- Introduction to Arrays (Novice): An array keeps many values of the same type together in one fixed-size container, like eggs in a carton.
- Array Basics (Novice): Create C# arrays, read and change their elements by index starting at 0, and use Length to find the last one.
Looping in C#
- While Loop (Novice): Repeat a block of code for as long as a condition stays true with C#'s while loop, and make sure the loop can end.
- Do-While Loop (Apprentice): Run a block of code at least once, then repeat it while a condition is true, with C#'s do-while loop.
- For Loop (Novice): Count through a range of numbers, or through an array's indexes forward, backward or in steps, with C#'s for loop.
- Foreach Loop (Apprentice): Visit every element of an array without an index using C#'s foreach loop, and leave a loop early with break or skip ahead with continue.
Exercise: Arrays and Loops
- Exercise: Arrays and Loops (Apprentice): Solve 17 problems with arrays and loops (filling, searching, totaling, finding the highest and lowest, reversing) and check each with tests.