Tutorpip← About this lessonOpen the sheet →Download PDF
Ages 8+ · Coding · Build a project
Make a quiz
1when flag clicked2ask "What is the red planet?"3if answer = Mars4 say "Yes!"5else6 say "Not quite."
A quiz: ask, check, reply.
The big ideaA quiz asks, keeps the answer in a box, and uses if else to reply.

How it works

A quiz has three jobs: it asks, it checks, and it replies.

An ask block shows a question and waits. Whatever is typed goes into a box called answer.

An if else block looks in the box and picks one path or the other, like a fork in the road. A say block shows the reply.

A quiz that says yes to everything checks nothing, so every answer needs a check.

Ask thequestionKeep the answerin a boxCheck it withif elseReply
What happens when Ana plays.

Example 1: A right answer

  1. Ana types Mars.
  2. The answer box holds Mars, so the if path runs.
  3. The quiz says "Yes! Mars is the red planet!"

Example 2: A different answer

  1. Ana types banana for fun.
  2. Banana is not Mars, so else runs.
  3. The quiz says "Not quite. The answer is Mars."

Example 3: The quiz that checked nothing

  1. Teo's first try was: ask the question, then say Correct!
  2. It never looked in the box, so Ana typed banana and it said Correct!
  3. The mix-up to fix: add an ask block, a box, and an if else to check.

Example 4: Three jobs

  1. Each question in a quiz has an ask, a check and a reply.
  2. A quiz of 3 questions has 3 × 3 = 9 jobs.
  3. Each job is done by its own block.

Words to know

ask block
Shows a question and waits for a typed answer.
answer box
The variable that holds what was typed.
if else
Picks one path or the other.
say block
Shows a reply.

Watch out

Try it

  1. In Teo's quiz, Ana types Mars. What does the quiz say?
  2. Ana types Venus. What does the quiz say?
  3. Which block does the checking: ask, say or if else?
  4. Does a quiz reply before an answer is typed?
  5. Teo's first quiz said Correct! to banana. What was the mix-up to fix?
Answers: 1. Yes! · 2. Not quite. · 3. if else · 4. No · 5. It never checked the answer
Try at homePretend to be a quiz. Ask a grown-up a question you know, like what colour is the sky? Listen to the answer. Then say: if the answer is blue, say yes. Else, say try again. Then swap roles, and let them be the quiz.
For grown-upsDo the Mission: pretend to be a quiz. Ask a question you know, listen to the answer, then say: if the answer is blue, say yes, else say try again. Then swap roles.
Open these notes on screenScan the code, or go to tutorpip.com.