Week 6: Brackets and braces
C# code typing course. 15 wpm, 91% accuracy.
Three bracket types do most of the work in everyday C#, and each has its own job. You already type round brackets in method calls. This week you add square brackets, [ and ], and curly braces, { and }. Square brackets describe array types and positions inside an array. Curly braces mark where a code block starts and ends. All of them come in pairs.
What you will learn
Square brackets describe an array type or pick one position in an array. Curly braces show the edges of a block:
int[]is the type for an array of whole numbers. The square brackets are part of the type.- The four lines below show a condition and its block. The curly braces mark where the block begins and ends.
if (score > 0)
{
Console.WriteLine("Great");
}
This week’s symbols on the US English layout:
[: press the [ key with the right pinky.]: press the ] key with the right pinky.{: press [ with Shift. Hold Shift with the opposite pinky (the left pinky) and press [ with the right pinky.}: press ] with Shift. Hold Shift with the opposite pinky (the left pinky) and press ] with the right pinky.
Technique tips
- Type the closing bracket right after the opening one, then fill in the contents. This keeps blocks from being left open.
- Press Shift before the curly brace keys and keep it held until the key is down. Release the key first, then Shift.
- Enter fills in the next line’s indentation when a block opens. Continue the code from there rather than retyping the indent.
Lessons
- Learn (10 to 15 minutes): Watch the demo for the four symbols, notice which ones need Shift, and type each one several times.
- Practice (10 to 15 minutes): Type this week’s text. For each opening bracket, think about its closing partner.
- Review (10 to 15 minutes): Take the two-minute test. Check which bracket caused mistakes and focus on it in the next lesson.
This week’s goal
The goal this week is 15 WPM with 91 percent accuracy. Stars work like this: finish the lesson for 1 star, reach 91 percent accuracy for 2 stars, and reach 15 WPM as well for 3 stars. A missing closing brace breaks the whole block, so get the pairs right before you chase speed.
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.