Lesson 6: Variables and Data

Learning Objectives

  1. Understand the concepts of sequence, loops, and conditional statements: To help students understand the basic elements of program control structures.
  2. Master basic control structures in visual programming: Students will be able to apply sequence, loops, and conditional statements in visual programming to complete simple programming tasks.
  3. Develop logical thinking and problem-solving skills: By writing programs, students will gradually learn to plan steps and optimize processes.

Course Outline

1. Introduction (10 minutes)

  • Introducing the Topic: Ask students: “If you want a robot to dance, what steps does it need to follow?” This will lead to the introduction of the concepts of “sequence,” “loops,” and “conditions.”
  • Preliminary Introduction: The teacher briefly explains the meaning of these three program structures:
    • Sequence: Executing instructions in order.
    • Loop: Repeating the same instructions.
    • Condition: Executing different instructions based on different situations.

2. Main Content (25 minutes)

  1. Sequential Structure (5 minutes)
    • Concept Explanation: Explain that a sequential structure executes each instruction in order.
    • Example Demonstration: Use visual programming to demonstrate a simple example where a character moves, turns, and speaks in sequence.
    • Practice: Have students write a simple sequential program, such as making a character move in four directions in order.
  2. Loop Structure (10 minutes)
    • Concept Explanation: Explain that a loop is used to repeat a piece of code, which can reduce repetitive work.
    • Types of Loops: Demonstrate two common types of loops in visual programming:
      • Fixed-count loop: Sets a specific number of repetitions, such as “repeat 10 times.”
      • Infinite loop: Repeats continuously until a certain stop condition is met.
    • Mini-Game: Robot Walks in a Square: Have students design a simple loop that makes a character automatically walk in a square. Students can set different numbers of repetitions to observe the effects.
  3. Conditional Statements (10 minutes)
    • Concept Explanation: Conditional statements choose to execute different instructions based on a “true” or “false” condition.
    • Example Demonstration: Use visual programming to show a conditional statement, for example, “if touching the edge, then turn.”
    • Mini-Task: Writing a Conditional Statement: Have students design a simple program that makes a character change direction or react when it encounters a specific situation (such as touching another character or the edge).

3. Comprehensive Practice: Creating a Small Interactive Game (10 minutes)

  • Project Introduction: Have students use sequence, loops, and conditional statements to create an interactive mini-game, such as a “chase game” where one character continuously chases another.
  • Group Activity: Students work in groups to design the mini-game, reinforcing their understanding of sequence, loops, and conditions, and exercising their teamwork and creativity.

4. Conclusion and Q&A (5 minutes)

  • Review of Key Points: Summarize the concepts of sequence, loops, and conditional statements, emphasizing their importance in programming.
  • Q&A Session: Answer students’ questions and encourage them to try more creative projects using these three structures after class.

Teaching Resources

  • Visual Programming Platform: Tools like Scratch allow students to visually understand sequence, loops, and conditions.
  • Videos and Pictures: Show real-life applications of loops and conditions, such as the changing of traffic lights, to help students understand abstract concepts.

After-Class Activity

  • Hands-on Task: Have students design a simple animation or mini-game in Scratch, using sequence, loops, and conditional statements as much as possible.
  • Thinking Task: Encourage students to observe examples of loops and conditions in their daily lives and share their findings in the next class.

🚀 Continue Your Learning Journey!

Navigate between lessons to explore more computer science concepts