Week 8: Conditions
Small Basic code typing course. 17 wpm, 92% accuracy.
A condition lets a program do different things depending on a question. If the score is high enough, show one message. If not, show another. In Small Basic this structure starts with If, continues with Then and ends with EndIf. This week your goal is to write these three keywords correctly and type the comparison symbols inside them without mistakes. A badly written condition either never runs or takes the wrong path.
What you will learn
This week has four symbols. On the US English layout:
:: ; key + Shift (Shift with the left pinky). Right pinky on the semicolon key.<: , key + Shift (Shift with the left pinky). Right middle finger on the comma key.>: . key + Shift (Shift with the left pinky). Right ring finger on the period key.=: = key, right pinky.
Example:
If score >= 50 Then
EndIf
The lines between If and EndIf run only when the condition is true. The >= sign means greater than or equal to. You will also type the colon in this week’s drills.
Technique tips
- Press Shift with your left pinky for
<and>. Keep the right hand steady and let only the needed finger move. - The colon needs Shift with the left pinky. The equals sign needs no Shift, so press it straight with the right pinky.
- Write an
Ifblock in order: theIfandThenline first, then the body, and theEndIfline last. You will never forget to close the block this way. - Enter fills in the indentation of the next line, so the lines inside the block are indented for you. Just type the code.
- After you type the two similar symbols,
<and>, press each one once slowly to feel the difference.
Lessons
- Lesson 1, 10 to 15 minutes: Learn the four symbols. Watch the keyboard demo and type each symbol three times.
- Lesson 2, 10 to 15 minutes: Build one
Ifblock. Write the condition, then the body, thenEndIf. - Lesson 3, 10 to 15 minutes: Review what you practiced, then take the 2-minute test.
This week’s goal
The targets are 17 wpm and 92% accuracy. Finishing the lessons earns one star. Reaching 92% accuracy earns the second star. The third star also needs 17 wpm. Check that every If has a matching EndIf. Missing one is one of the most common mistakes.
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.