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 for line 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

  1. 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.
  2. 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.
  3. 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.

` ~ 1 ! 2 @ 3 # 4 $ 5 % 6 ^ 7 & 8 * 9 ( 0 ) - _ = + Backspace Tab Q W E R T Y U I O P [ { ] } \ | Caps A S D F G H J K L ; : ' " Enter Shift Z X C V B N M , < . > / ? Shift Ctrl Win Alt Alt Gr Win Menu Ctrl

This week’s lessons

Do the lessons in order. Each one ends with a test, and your best result is saved.

  1. Lesson 1: Learn

    New symbols: + = < ;

    12 minutes

    Start
  2. Lesson 2: Practice

    Practice

    12 minutes

    Start
  3. Lesson 3: Review and test

    Review and test

    12 minutes

    Start

All weeks