Objectives:
- Students will learn what a loop is and how to create basic loops with simple code.
- Students will be able to identify loops in simple code.
Materials:
- White board
- Markers
- Computers with code editor open
Lesson Plan:
-
Introduction (5 mins): Ask the students what they think is a loop in coding. Give them time to talk and brainstorm, explain that loops are instructions that repeat.
-
Examples (10 mins): Write examples of basic loops on the whiteboard (e.g. a for loop). Explain how a loop works step-by-step. Ask the students to explain the code in their own words.
-
Guided Practice (15 mins): Have the students open up a code editor (e.g. Repl.it) on their computers. Ask them to type out the code from the examples you showed on the board into their code editor. Ask them to run the code and explain what happens.
-
Independent Practice (15 mins): Ask the students to create a simple loop of their own. So, for example, a loop that counts from 1 to 10 and writes out “Counting X” for each number. Ask them to create this with a for loop and then explain the code to the class.
-
Conclusion (5 mins): Wrap up the lesson by explaining that loops are a fundamental part of coding. Give the students a simple final exercise to complete. Tell them to create a loop which prints out their name 10 times.
Loading...