Week 9: Loops
C code typing course. 18 wpm, 92% accuracy.
A loop repeats the same work as many times as you need. In C, a for loop has three parts: a starting value, a condition that must stay true, and a step that runs after each round. The loop below starts i at 0 and keeps going while i is less than 5, so it runs five times. This week you learn to type +, =, < and ; on the US English layout.
What you will learn
On the US English layout:
+: the = key with Shift. Press Shift with the opposite pinky, and press the = key with your right pinky.=: the = key, with your right pinky.<: the , key with Shift. Press Shift with the opposite pinky, and press the , key with your right middle finger.;: the ; key, with your right pinky.
A loop to type out:
for (int i = 0; i < 5; i++) {
printf("hello");
}
Technique tips
- The step
i++uses the plus sign twice. Type the first plus, then finish the second one before you move on. - Think of the opening parenthesis and the opening brace as a pair. The loop body ends with a
}that you must not forget. - Each part of the
forline is separated by a semicolon. Check that you typed two of them inside the parentheses. - Press Enter and the line inside the loop is indented for you. Do not add spaces by hand.
Lessons
- Lesson 1, learn (10 to 15 minutes): Watch the four symbols on the keyboard demo. Type each one five times, and keep Shift timing in mind.
- Lesson 2, practice (10 to 15 minutes): Type short loop lines such as
for (int i = 0; i < 3; i++). Check that every line has three semicolons inside its parentheses. - Lesson 3, review (10 to 15 minutes): Take the two-minute test with loop lines. Save your result and practice the symbols you missed.
This week’s goal
This week’s target is 18 WPM and 92% accuracy. Finishing the week’s lessons earns you 1 star. Reach 92% accuracy for 2 stars, and also reach 18 WPM for 3 stars. A missing semicolon stops the loop line from working, so accuracy comes 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.