Studyfin Studyfin ✨ Sign up free

Conditionals

Grade 3 · Coding · Free lesson

Hi there! I am Studyfin, your coding buddy. Today, we will learn how to make computers make choices!

Computers need to make choices just like us. We use 'if-then' plans to do this. These plans are called conditionals.

ai generated

Think of a rainy day. If it rains, then you take an umbrella. If it is sunny, you do not need one!

If it rains -> Use umbrella!

In coding, we use blocks to build these rules. An 'if' block checks a condition. If the condition is true, the computer runs the code inside.

IF key pressed THEN Jump!
✏️ Worked example

Let us design a plan for a game. We want a character to jump ONLY when they touch water. How do we write this step-by-step?

  1. First, we find the start event. We use 'When green flag clicked'.
  2. Next, we add a loop. This keeps the game checking the rule forever.
  3. Then, we add our conditional block. We use the 'if' block.
  4. Now, we set the condition. We write: 'if touching water'.
  5. Finally, we put the action inside. We write: 'then play splash sound and jump!'.
gym
Want the full interactive lesson — quiz, animations, and Finn cheering them on?

More Coding lessons