Week 12: Working with text

Small Basic code typing course. 21 wpm, 93% accuracy.

Text appears everywhere in programs: a user’s name, a message or a file path. Joining pieces of text, measuring them and writing them to the screen are everyday tasks. In Small Basic you join two strings with the plus sign. To find how long a string is, you use the Text.GetLength function. This week’s goal is to type quotes, periods and plus signs correctly so these operations work without mistakes.

What you will learn

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

  • ": ’ key + Shift, opposite pinky. Right pinky.
  • .: . key, right ring finger.
  • +: = key + Shift, opposite pinky. Right pinky.

Example:

greeting = "Hello" + " world"
TextWindow.WriteLine(Text.GetLength(greeting))

The first line joins two strings and stores the result in greeting. The second line writes the length of the joined text, which is 11 characters. The period in Text.GetLength separates the library name from the function name.

Technique tips

  • Type quotes at the start and end of each string with your right pinky. Think of each string as a complete unit with its quotes.
  • Press Shift with the opposite pinky for + and for the quote mark. Keep your right hand steady.
  • Notice the switch between the period and the quote. The period uses your right ring finger, and the quote uses Shift with the opposite pinky.
  • Type spaces inside strings on purpose. A space is a character, and it counts toward the length.
  • Enter fills in the indentation of the next line. Keep long joined lines short if you can.

Lessons

  1. Lesson 1, 10 to 15 minutes: Learn the three symbols. Watch the keyboard demo and type each symbol three times.
  2. Lesson 2, 10 to 15 minutes: Join two strings and print the length of the result.
  3. Lesson 3, 10 to 15 minutes: Review what you practiced, then take the 2-minute test.

This week’s goal

The targets are 21 wpm and 93% accuracy. Finishing the lessons earns one star. Reaching 93% accuracy earns the second star. The third star also needs 21 wpm. One missing quote breaks the whole string, so check the quote marks on every line.

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