Week 5: Comparison and logic
C code typing course. 14 wpm, 91% accuracy.
Comparison operators check two values against each other. < means less than and > means greater than. == asks whether two values are equal. ! means “not”, while && and || join several conditions together. This week you learn to type these six symbols 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 middle finger.>: the . key with Shift. Press Shift with the opposite pinky, and press the . key with your right ring finger.!: the 1 key with Shift. Press Shift with the opposite pinky, and press 1 with your left pinky.=: the = key, with your right pinky.&: the 7 key with Shift. Press Shift with the opposite pinky, and press 7 with your right index finger.|: the \ key with Shift. Press Shift with the opposite pinky, and press the \ key with your right pinky.
A quick example: if (a == b && b > c) runs only when both conditions are true. Remember that && and || are each typed as two symbols in a row.
Technique tips
- A single
=stores a value, while==compares two values. The two do different jobs, so count the equals signs each time. - Type
&&and||as pairs. As soon as you type the first symbol, finish the pair with the second. - Press Shift before the symbol key, and let go of Shift only after the symbol is down. This keeps the symbol from coming out wrong.
- Check the screen after typing
==. Make sure there are two equals signs, not one.
Lessons
- Lesson 1, learn (10 to 15 minutes): Watch the six symbols on the keyboard demo. Notice which finger holds Shift, then type each symbol five times.
- Lesson 2, practice (10 to 15 minutes): Type short conditions such as
a == b,x > 0and!ok && count > 0. Check that every symbol is complete at the end of each line. - Lesson 3, review (10 to 15 minutes): Take the two-minute test with condition lines. Save your result and practice the symbols you got wrong.
This week’s goal
This week’s target is 14 WPM and 91% accuracy. Finishing the week’s lessons earns you 1 star. Reach 91% accuracy for 2 stars, and also reach 14 WPM for 3 stars. One wrong symbol can change the meaning of a whole condition, so focus on accuracy 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.