Week 5: Comparison and logic
C# code typing course. 14 wpm, 91% accuracy.
A condition compares values and decides what the program does next. Is the age 18 or more? You answer these with comparison symbols such as <, > and =. To check several conditions together you use & and |, and to reverse a condition you use !. Many of these symbols need Shift, and some appear in pairs such as >= or &&.
What you will learn
Comparison and logic symbols combine into conditions that the program checks:
if (age >= 18)checks whether the age is 18 or more.>=is two symbols: greater than and equals.if (!full && open)checks two conditions together.!reverses the first one, and&&requires both checks to be true.
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 middle finger.>: press . with Shift. Hold Shift with the opposite pinky (the left pinky) and press . with the right ring finger.!: press 1 with Shift. Hold Shift with the opposite pinky (the right pinky) and press 1 with the left pinky.=: press the = key with the right pinky.&: press 7 with Shift. Hold Shift with the opposite pinky (the left pinky) and press 7 with the right index finger.|: press \ with Shift. Hold Shift with the opposite pinky (the left pinky) and press \ with the right pinky.
Technique tips
- Write two-symbol operators such as
>=and&&as one smooth motion. The second symbol should follow the first without a pause. - Enter fills in the next line’s indentation. A condition inside a block already has the right indent, so do not retype it.
Lessons
- Learn (10 to 15 minutes): Watch the demo for all six symbols, notice which hand holds Shift, and type each symbol several times.
- Practice (10 to 15 minutes): Type this week’s condition lines. Think about the two values on either side of each comparison.
- Review (10 to 15 minutes): Take the two-minute test. Note which symbol caused mistakes and focus on it in the next lesson.
This week’s goal
The goal this week is 14 WPM with 91 percent accuracy. Stars work like this: finish the lesson for 1 star, reach 91 percent accuracy for 2 stars, and reach 14 WPM as well for 3 stars. Mixing up < and > changes what the program decides, 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.