This repository has been archived by the owner on May 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Lesson 2 (ControlFlow & Collections)
Sally Steuterman edited this page Jul 28, 2020
·
1 revision
- The C# syntax for conditionals and loops:
- if, else, if/else
- switch statements
- for, while, and do...while
- break and continue statements
- How and when to use list, array, and dictionary collections.
- Remind students that Graded Assignment #1 is due soon! They should be able to complete it after today's class.
- Check with your class Candidate Engagement Manager for any other announcements.
- Encouragement: Point out that learning a second coding language is usually easier than learning the first. The students already know how to use loops and conditionals, so applying them in C# is just a matter of recognizing the different syntax.
- Ask the class to give some examples of similarities or differences for conditionals and loops in C# vs. other coding languages.
- The fallthrough aspect of
switch
statements is not always obvious and should be reviewed. However, do not sink too much time into this, since the students will useif/else
statements much more often thanswitch
. - Ask the students to explain the difference between
while
anddo...while
loops. - Review how to use
break
andcontinue
statements within loops. - Review
foreach
loops in the context of array and list collections. Note how the syntax changes when applied to dictionaries. - As much as possible, live-code examples for lists and dictionaries, including how to use the most common methods.
- With your group, discuss the "Some Items to Ponder Before Starting" section of the studio instructions.
- Remember to check in with EVERY student during the studio time.
- Ask them detailed questions about studio 1 if they did not finish it before the end of the last class.
- As they code studio 2, ask them to explain what different portions of their code does.
- Common mistakes:
- Not properly setting up the
Main
method. - Forgetting to import the necessary classes (e.g. List).
- Even though dictionaries are the better option, many students will try to use arrays or lists because they see them as being easier. While the students could make these collections work, be prepared to talk about the differences between the different types of collections and why dictionaries would be the better option.
- Not properly setting up the
- Be sure to do a visual check of your students' code.
- For the students who finish early, ask guided questions to encourage them to try one or more of the bonus tasks (e.g. "How could you modify your code to count 'a' and 'A' as the same letter?").
- Remind your students to push their work up to GitHub when they finish the studio.