← Years 5–6 Creating Digital Solutions

Input with ask and answer

A block that shows a question and waits. The user types a reply, and it goes into the answer block. You can use answer straight away or save it in a variable.

Understanding Input with ask and answer in Years 5–6 Creating Digital Solutions

What it does: The answer block goes inside say, so the sprite shows what the user typed after ask and wait. Answer changes every time ask and wait runs, so set a variable to answer to keep the reply. You must ask first. If you set the variable before asking, it saves the old answer, not the new one. The answer block only keeps the latest reply. When a new question is asked, the old answer is replaced.

Common mistakes: The say block only shows words. It does not wait for a reply or save one in answer. The line should be ask [Fav colour?] and wait. The blocks are the wrong way round. The variable age should be set to the answer reporter, so it should be set [age] to (answer).

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 51–60) and word search (Modules 41–74).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which block shows a question and waits for the user to type a reply?
ask and waitsay for 2 seconds
Matches
say (answer) ask [What is your name?] and wait
↓
The say block comes before the ask block, so answer is empty or holds an old reply. Ask first, then use answer.
Applying
Meanings
Term
ask and wait
Meaning
A block that shows a question and waits. The user types a reply, and it goes into the answer block. You can use answer straight away or save it in a variable.
Practice
ask [What is your name?] and wait
Testing
Gaps
"What is your name?" and wait
Check Answer
Spots
1ask [Fav colour?] and wait
2say [Fav colour?]

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Badger' badge — Determined Digger, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which block shows a question and waits for the user to type a reply?
A. ask and wait ✓
B. say for 2 seconds
The 'ask and wait' block shows a question and then waits. A 'say' block only shows a speech bubble and does not wait for a reply.
2. A user types their name after an 'ask and wait' block. Where does the reply go?
A. Into the answer block ✓
B. Into the green flag block
The typed reply is held in the 'answer' reporter block until the next ask and wait block runs.
3. Which script saves the answer in a variable called name?
A. set name to answer, then ask What is your name? and wait
B. ask What is your name? and wait, then set name to answer ✓
You must ask first. If you set the variable before asking, it saves the old answer, not the new one.
4. Which statement about the 'answer' block is true?
A. It holds every reply the user has ever typed
B. It holds the most recent reply typed into an ask and wait block ✓
The answer block only keeps the latest reply. When a new question is asked, the old answer is replaced.
5. You ask 'What is your favourite colour?' and the user types 'blue'. Then you ask 'How old are you?' and the user types '11'. What is in the answer block now?
A. 11 ✓
B. blue
Each new ask and wait replaces the answer. To keep 'blue', you needed to save it in a variable first.

Match the Pairs

ask [What is your name?] and wait → Shows a question on the stage and waits for the user to type a reply and press enter.
answer → A reporter block that holds the last reply the user typed after an ask and wait block.
Ask a question, then make the sprite say the reply the user typed. → ask [Favourite food?] and wait say (answer)
Save the user's reply in a variable so you can use it later, even after asking another question. → ask [How old are you?] and wait set [age] to (answer)
say (answer) ask [What is your name?] and wait → The say block comes before the ask block, so answer is empty or holds an old reply. Ask first, then use answer.
ask [Your pet's name?] and wait ask [Your age?] and wait set [pet] to (answer) → The second ask replaced answer, so pet gets the age. Save the first answer in a variable before asking again.

Key Term

ask and wait
A block that shows a question and waits. The user types a reply, and it goes into the answer block. You can use answer straight away or save it in a variable.

Fill in the Blanks

1. ask "What is your name?" and wait
Hint: Type the first word of the block that shows a question to the user
2. ask "What is your name?" and wait
Hint: Type the last word that makes the program pause until the user replies
3. ask "What is your name?" and wait say (answer)
Hint: Type the name of the reporter block that holds what the user typed
4. ask "Favourite animal?" and wait set pet to (answer) say (pet)
Hint: Type the reporter block that gives the typed reply, so it can be saved in the variable
5. ask "Favourite animal?" and wait set pet to (answer) say (pet)
Hint: Type the name of the variable that saves the reply

Spot the Error

Question 1
A ask [Fav colour?] and wait
B say [Fav colour?]
C say (colour)
Line B — The say block only shows words. It does not wait for a reply or save one in answer. The line should be ask [Fav colour?] and wait.
Question 2
A when green flag clicked
B ask [Your age?] and wait
C set [answer] to (age)
D say (age)
Line C — The blocks are the wrong way round. The variable age should be set to the answer reporter, so it should be set [age] to (answer).
Question 3
A say [Fav colour?]
B set [colour] to (answer)
C say (colour)
Line A — Nothing asks the user for anything, so there is no reply to save. Line 1 should be ask [Fav colour?] and wait.
Question 4
A when green flag clicked
B ask [Your name?] and wait
C set [name] to (answer)
D say (join [Hi ] [name])
Line D — [name] in square brackets is just the word name, so it would say Hi name. The variable reporter should be in round brackets: (name).
Question 5
A when green flag clicked
B ask [Pick a number]
C if <(answer) = [7]> then
D say [Correct!]
E end
Line B — The block is missing 'and wait'. Without it the program does not stop for the user to type, so answer is not ready. It should be ask [Pick a number] and wait.

Student with a class code? Join your class →