Week 9: Loops

Small Basic code typing course. 18 wpm, 92% accuracy.

A loop repeats an action several times. Instead of writing the same line ten times, you can run it ten times with one loop. In Small Basic, a counted repeat uses For, and a repeat that continues as long as a condition holds uses While. This week’s goal is to build loops completely and type the symbols inside them correctly. Do not forget to finish each loop with an EndFor or EndWhile line.

What you will learn

This week has four symbols. On the US English layout:

  • +: = key + Shift, opposite pinky. Right pinky.
  • =: = key, right pinky.
  • <: , key + Shift (Shift with the left pinky). Right middle finger on the comma key.
  • ;: ; key, right pinky.

Example:

For i = 1 To 5 Step 2
  TextWindow.WriteLine(i)
EndFor

This loop starts i at 1, adds 2 each time and stops after 5. It writes 1, 3 and 5 to the screen. The semicolon ; is practiced as a typing drill this week. It does not appear in the examples here.

Technique tips

  • Press Shift with the opposite pinky for +. Keep your right hand steady while Shift is held down.
  • Press Shift with your left pinky for <, and keep your right middle finger on the comma key.
  • Start a loop with its For or While line, fill in the body, and finish with EndFor or EndWhile at the end.
  • Enter fills in the indentation of the next line. The body of the loop is indented for you automatically.
  • Put spaces between numbers and operators. This makes it easier to follow each step of the loop on the screen.

Lessons

  1. Lesson 1, 10 to 15 minutes: Learn the four symbols. Watch the keyboard demo and type each symbol three times.
  2. Lesson 2, 10 to 15 minutes: Write a For loop. Then try a short While loop using While x < 10.
  3. Lesson 3, 10 to 15 minutes: Review what you practiced, then take the 2-minute test.

This week’s goal

The targets are 18 wpm and 92% accuracy. Finishing the lessons earns one star. Reaching 92% accuracy earns the second star. The third star also needs 18 wpm. Closing every loop is the first rule of working code, so check for it before you speed up.

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

    13 minutes

    Start

All weeks