Week 9: Loops
C# code typing course. 18 wpm, 92% accuracy.
A loop lets you repeat a task without copying the same lines again and again. A counter that counts to five, or code that runs the same step for every item in a list, fits neatly into one loop. Writing one means typing several symbols in a row: the = that sets the counter, the < that checks it, the + that increases it, and the semicolons that separate the parts.
What you will learn
A for loop has three parts: a starting point, a condition and a step. Semicolons separate them:
for (int i = 0; i < 5; i++)starts the counter at zero, keeps going while it is below five, and adds one each time around.i++is the short way to add one toi. The++is two plus signs typed together.
for (int i = 0; i < 5; i++)
{
Console.WriteLine(i);
}
This week’s symbols on the US English layout:
+: press = with Shift. Hold Shift with the opposite pinky (the left pinky) and press = with the right pinky.=: press the = key with the right pinky.<: press , with Shift. Hold Shift with the opposite pinky (the left pinky) and press , with the right middle finger.;: press the ; key with the right pinky.
Technique tips
- Type
++as two plus signs in one quick rhythm. A pause between them breaks the header. - Before you type a loop, count its three parts in your head: start, condition and step. The semicolons mark the boundaries.
- Press Shift before the plus sign and keep it held until the key is down. Release the key first, then Shift.
Lessons
- Learn (10 to 15 minutes): Watch the demo for the four symbols, notice which ones use Shift, and type the
forline several times. - Practice (10 to 15 minutes): Type this week’s loop blocks. Keep the order of the three parts and the semicolons in the same places.
- Review (10 to 15 minutes): Take the two-minute test. Note which symbol slowed you down and focus on it in the next lesson.
This week’s goal
The goal this week is 18 WPM with 92 percent accuracy. Stars work like this: finish the lesson for 1 star, reach 92 percent accuracy for 2 stars, and reach 18 WPM as well for 3 stars. A missing semicolon stops the loop from compiling, so get the header right first.
Symbols this week
The colored keys are the ones you learn this week. The color shows which finger presses the key.
This week’s lessons
Do the lessons in order. Each one ends with a test, and your best result is saved.