Langkau ke kandungan

    Loop Lagoon

    Loops Umur 6–8

    Use “repeat” blocks to do the same steps again and again, and turn long programs into short ones.

    • Umur 6–8
    • 3 misi
    • Permulaan → Semakin mahir → Cabaran

    A loop repeats instructions. Instead of writing “move right” five times, a programmer writes “repeat 5 × move right”. Loops make programs shorter, clearer and easier to change.

    Apa yang akan dipelajari anak anda

    • Work out what a repeat loop does
    • Count the total moves made by a loop
    • Replace a long list of repeated steps with a loop
    • Combine a loop with other instructions

    Why loops matter

    Loops are one of the most powerful ideas in coding. Loop Lagoon uses colourful code blocks, like the ones in Scratch and ScratchJr, so children learn to read the kind of code they will meet in real coding apps.

    A great way to understand a loop is to “unroll” it: “repeat 3 × (→ ↑)” means → ↑ → ↑ → ↑.

    Contoh soalan

    Berikut ialah beberapa soalan seperti dalam misi pertama. Bolehkah anda menjawabnya?

    1. 1. How many squares does the robot move?

      Tunjuk jawapan

      Jawapan: 2. The loop repeats "move ←" 2 times, so the robot moves 2 squares.

    2. 2. True or false? The robot moves 3 squares.

      Tunjuk jawapan

      Jawapan: Betul. The loop repeats "move ↑" 3 times, so the robot moves 3 squares.

    3. 3. How many squares does the robot move?

      Tunjuk jawapan

      Jawapan: 3. The loop repeats "move ↓" 3 times, so the robot moves 3 squares.

    4. 4. Would a loop help?

      • switch on a lamp
      • water 10 plants
      • draw the 6 sides of a hexagon
      • say your name
      • count to 100

      Bakul: A loop helps · No loop needed

      Tunjuk jawapan

      Jawapan: A loop helps: count to 100, draw the 6 sides of a hexagon, water 10 plants · No loop needed: say your name, switch on a lamp. Loops save writing the same steps again and again.

    Tip untuk orang dewasa

    • Make up a dance with a loop: “repeat 4 times: clap, stamp”.
    • Spot loops in songs and stories with repeating lines.