Week 11: Lists and arrays
Small Basic code typing course. 20 wpm, 93% accuracy.
An array keeps many related values under one name. You can store the names of a class or a shopping list without opening a separate variable for each item. In Small Basic, you create an array by assigning values to items inside square brackets, using a number or a text key. You read an item back with the same square brackets. This week’s goal is to type square brackets and commas correctly.
What you will learn
This week has three symbols. On the US English layout:
[: [ key, right pinky.]: ] key, right pinky.,: , key, right middle finger.
Example:
fruits[1] = "apple"
fruits[2] = "pear"
TextWindow.WriteLine(fruits[1])
The first two lines assign values to items of the array. The third line writes the first item, the text “apple”, to the screen. The comma separates the values in a call, such as Math.Max(4, 9).
Technique tips
- The
[and]keys are both typed with your right pinky. Keep that finger ready and move only as far as needed. - When you read an item, think of the
[and]pair together. Typing only one of them will break the line. - Use your right middle finger for the comma, and put a space after it.
- Enter fills in the indentation of the next line. Write each array assignment on its own line so every item is easy to follow.
- Split long array work into short lines, and check each line once you finish it.
Lessons
- Lesson 1, 10 to 15 minutes: Learn the three symbols. Watch the keyboard demo and type each symbol three times.
- Lesson 2, 10 to 15 minutes: Assign three items to an array and print one of them.
- Lesson 3, 10 to 15 minutes: Review what you practiced, then take the 2-minute test.
This week’s goal
The targets are 20 wpm and 93% accuracy. Finishing the lessons earns one star. Reaching 93% accuracy earns the second star. The third star also needs 20 wpm. Check the commas and closing brackets as you type, since they carry most of the detail in array code.
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.