Week 11: Lists and arrays
C# code typing course. 20 wpm, 93% accuracy.
When you need to keep several values together, you use an array or a list. A class might store ten test scores in one variable, for example. In these structures, square brackets show the type of the collection and also how to reach one item in it. Commas separate the values from one another. This week you practice [, ] and , together, so that a whole array line comes out smoothly.
What you will learn
An array takes its values between curly braces, separated by commas. To reach one item, you put its position number inside square brackets:
int[] scores = { 70, 85, 90 };
Console.WriteLine(scores[0]);
int[] scoresdeclares an array of whole numbers. The square brackets are part of the type.scores[0]gives the first item, which prints70. In C#, counting starts at zero.
This week’s symbols on the US English layout:
[: press the [ key with the right pinky.]: press the ] key with the right pinky.,: press the , key with the right middle finger.
Technique tips
- Type the closing square bracket right after the opening one, then fill in the position or the values. This keeps the item reference complete.
- Think of the commas as a steady beat between values. Each value is followed by a comma and then the next value.
- Return to the home row after each bracket. Frequent returns keep your rhythm even.
- Enter fills in the next line’s indentation. When an array sits inside a block, continue from the indent rather than retyping it.
- Read the whole array line once before you type it. Knowing how many commas it needs makes the line easier to finish.
Lessons
- Learn (10 to 15 minutes): Watch the demo for
[,]and,, and type the array declaration line several times. - Practice (10 to 15 minutes): Type this week’s array declarations and item reads. Keep the commas and brackets in the same places on every line.
- 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 20 WPM with 93 percent accuracy. Stars work like this: finish the lesson for 1 star, reach 93 percent accuracy for 2 stars, and reach 20 WPM as well for 3 stars. A missing square bracket means the item cannot be reached, so accuracy comes first. Speed follows as you repeat the same array patterns.
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.