Tap play and I''ll read this lesson to you like a story.
🪙0
0 of 6
🎮 you are a where a , and its . To make that , your needs to do things in , make and — all while the . That mix of is what use every day. In this you will that , and , how and a , and a who called . Let's !
Every is from . run one after another in , like in a . the a and a — in this is an IF . a of again and again — in this is a . all . For : 10 — , IF there is a gem THEN add 1 to , do — END . how the a it. like this you with , .
✨
🧠 : The from the of a called . His on the of .
Structure
What it does
Example in pseudocode
Sequence
Steps run in order, one after another
move forward, pick up gem, move forward
Selection
Program chooses a path based on a condition
IF score > 10 THEN display 'Winner!'
Repetition
A block of steps is repeated
REPEAT 5 times: move forward END REPEAT
The three building blocks of algorithms
A is like a box the . You it a , a in it, and that as the . For , a called at 0. Each the a gem, the : = + 1. The is out (old one), then the is in the box. let things — the , a , how many . , a could not that over .
💡
💡 Tip: , like or than just x or a. make your much to , and .
🔗 Match each programming term to its correct meaning. Drag each term to its definition.
Variable
Selection
Repetition
Sequence
Nested structure
Now let us an . to be the — you each and what to every . at this for the :
= 0
= 3
5 :
IF gem THEN = + 2
IF THEN = - 1
END
After 5 , if the 3 and 1 , would be 6 and would be 2. like this — on or in your — is one of the most to an before you even run it.
Move
What the robot finds
score
lives
Start
—
0
3
1
Gem 💎
2
3
2
Nothing
2
3
3
Gem 💎
4
3
4
Trap ⚠️
4
2
5
Gem 💎
6
2
Tracing the gem-collecting robot: 3 gems and 1 trap in 5 moves
🧩 🤖 Put these steps of a gem-collecting algorithm into the correct order. Drag them into the right sequence.
End the loop and display final score
IF trap found THEN subtract 1 from lives
IF gem found THEN add 2 to score
Move the robot forward one step
Start the REPEAT loop for 5 turns
Set score = 0 and lives = 3
A is a bug where the but the because the is . It is from a , which is a in or that the at all. are to . the gem : = - 2 of + 2. The would run but the would go of up! To , use these : 1) the . 2) the by . 3) what you with what . 4) the the . 5) Fix and to the fix .
The five systematic steps for debugging a logical error.
⚠️
⚠️ out: will is not — it is ! so you WHY an is before you .
🗂️ 🐛 Sort each item into the correct category — is it a logical error or a syntax error?
score = score - 1 when gems should increase score
Missing END REPEAT so the loop never closes
IF lives = 0 used instead of IF lives < 1 so game never ends
A variable spelled 'Scroe' in one line and 'Score' in another
Loop repeats 4 times instead of 5 so one gem is never collected
IF statement missing its THEN keyword
your , the is . Ask : does the its ? Does it every , ? For , what if 0 — does the ? Could the be more , using to get the ? their and . You add: IF = 0 THEN ' Over' and the . is not a that your — it is a that you like a who to make things . 🌟
🃏 Test your knowledge! Flip each card to check the definition.
Tap each card to see the answer.
Quiz time! 📝
Designing and Debugging Complex Programs — Check Your Understanding
Question 1 of 5
Tip: log in to save your score and track progress.
Finished?
Log in to mark this lesson complete and track your progress.