Skip to main content

If/else conditions: which way does Pemi go?

The PEEMS team · Published November 10, 2026 · 3 min read

The Pemi CS level "Which way round the boulders?": if/else and repeat blocks beside a grid path with crates and gems

If/else lets a program choose what to do depending on the situation. In Pemi CS, children in grades 3–5 practise it by helping Pemi decide which way to go around obstacles.

"If it rains, take an umbrella; otherwise, wear a hat." That everyday sentence is an if/else condition, one of the core ideas of programming. Children use it daily long before they write a line of code.

What is a condition?

A condition lets a program choose what to do depending on the situation:

  • If it is raining, then take an umbrella.
  • Otherwise, wear a hat.

The program checks whether the condition is true. If it is, it follows the "if" branch; if not, it follows the "else" branch.

In the game: Pemi has to choose

In Pemi CS for grades 3–5, conditions show up in small, concrete situations. In one level there are crates on the path that need to be moved down into the cellars. Children fill in the blank slots to finish the program, which includes an "if it sees a crate" block: Pemi carries out a series of actions only when there is a crate in front of it.

A Pemi CS level: a program with an "if it sees a crate" block, with Pemi next to crates on the path

Some levels are a little harder: after a rockslide has scattered crystal shards along the path, the program combines a repeat block with an if/else block so that Pemi reacts correctly each time it sees a shard.

The Pemi CS level "Which way round the boulders?": repeat and if/else blocks next to a grid path with crates, gems and a flag

Run the program, watch Pemi move, and fix what went wrong: that is how children come to see why conditions matter.

When your child gets stuck

  • Ask: "What does Pemi see ahead right now?" before asking "what is the next step?"
  • Use the Step button to watch whether the condition is true or false at each spot.
  • Let your child say it out loud, like telling a story: "If… then…, otherwise…"

Frequently asked questions

How is if/else different from a plain "if"? A plain "if" only does something when the condition is true. If/else adds an "otherwise" branch, so the program always has something to do in both cases.

Does my child need to know English to understand "if/else"? The blocks are shown in the language of the interface. "If/else" is simply the name children will meet again in Python.

What should my child learn before conditions? Usually sequences and loops come first, but every child has their own pace.

When do I use a condition, and when a loop? A loop is for doing something again and again; a condition is for choosing what to do depending on the situation. Many levels combine both, such as a repeat block with an "if it sees…" block inside.

Want to try it together?

If/else conditions appear in many Pemi CS levels, and you can explore them with your child. Pemi CS is open now and international families are welcome to register their interest by email.

Keep reading: From block coding to Python: when is the right time to switch? · Variables and counting: Pemi's seed store

The PEEMS team

Nov 10, 2026

Switching to Python too early frustrates children; too late and they get bored. This article lists signs of readiness, a path from picture blocks to text blocks to Python, and why ideas should come before syntax.

Nov 10, 2026

In event-driven coding, a program waits for something to happen and then reacts. Pemi CS levels such as "when I step on…" help children in grades 3–5 meet the idea through play.

Nov 10, 2026

A variable is like a labelled box in which a program remembers a value, such as how many seed bags it has picked up. Pemi CS's seed store level helps children in grades 3–5 meet this idea.