← Years 5–6 Creating Digital Solutions

Input and output in an algorithm

ASK is an input step: it asks the user for a value and stores it in a variable. SHOW is an output step: it displays a result, like a message, on the screen.

Understanding Input and output in an algorithm in Years 5–6 Creating Digital Solutions

What it does: The variable name holds the answer from the earlier ASK step. SHOW can use it later to display a personal message. The name must be asked and stored before it can be shown. The order of steps matters. Waiting for the user to type is what ASK does. SHOW only displays output.

Common mistakes: SHOW is an output step and only displays things. To ask the user for a value and store it in name, line 1 should start with ASK. The answer was stored in a variable called name, but this line uses nam. The variable name must match exactly, so it should be + name.

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 11–20) and word search (Modules 1–20).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which step is an INPUT step?
SHOW the message on the screenASK the user for their name
Matches
1. SHOW name 2. ASK "What is your name?" and store in name
↓
SHOW comes before ASK, so the variable name has no value yet. ASK must come first so the answer is stored before it is shown.
Applying
Meanings
Term
ASK and SHOW
Meaning
ASK is an input step: it asks the user for a value and stores it in a variable. SHOW is an output step: it displays a result, like a message, on the screen.
Practice
ASK "What is your name?" and store in name
Testing
Gaps
name ← "What is your name?"
Check Answer
Spots
1SHOW "Your name?" INTO name
2SHOW "Hello, " + name

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

The 'Oryx' badge — Desert Navigator, 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 step is an INPUT step?
A. ASK the user for their name ✓
B. SHOW the message on the screen
ASK is an input step. It gets a value from the user. SHOW is an output step because it displays something.
2. Which step is an OUTPUT step?
A. ASK "What is your name?" and store it in name
B. SHOW "Hello!" ✓
SHOW is an output step. It puts a message on the screen for the user to see.
3. What happens to the answer when an algorithm ASKs for a name?
A. It is stored in a variable ✓
B. It is shown on the screen straight away
An input step stores the answer in a variable, like name. Later steps can use it. Nothing is shown unless there is a SHOW step.
4. Which algorithm greets the user by the name they typed?
A. 1. SHOW "Hello " and name 2. ASK "Your name?" and store in name
B. 1. ASK "Your name?" and store in name 2. SHOW "Hello " and name ✓
The name must be asked and stored before it can be shown. The order of steps matters.
5. Which step uses the stored answer in a later step?
A. SHOW "Nice to meet you, " and name ✓
B. ASK "What is your name?"
Using the variable name in a SHOW step uses the value that was stored earlier by ASK.

Match the Pairs

ASK "What is your name?" and store in name → An input step: it asks the user for their name and keeps the answer in the variable called name
SHOW "Welcome to the game!" → An output step: it displays a message on the screen for the user to read
Using the stored answer in a later step, so the message includes the user's name → SHOW "Hello, " and name
An input step asks the user for a value and stores it in a variable → ASK "What is your favourite colour?" and store in colour
1. SHOW name 2. ASK "What is your name?" and store in name → SHOW comes before ASK, so the variable name has no value yet. ASK must come first so the answer is stored before it is shown.
ASK "Hello, " and name → ASK was used to display a message, but ASK is for input. SHOW should be used to display a message.

Key Term

ASK and SHOW
ASK is an input step: it asks the user for a value and stores it in a variable. SHOW is an output step: it displays a result, like a message, on the screen.

Fill in the Blanks

1. name ← ASK "What is your name?"
Hint: Type the input keyword that asks the user for a value.
2. name ← ASK "What is your name?" SHOW "Hello, " + name
Hint: Type the output keyword that displays a message on the screen.
3. name ← ASK "What is your name?" SHOW "Hello, " + name
Hint: Type the variable that holds the user's stored answer.
4. name ← ASK "What is your name?" SHOW "Nice to meet you, " + name
Hint: Type the variable that stores the answer. The next step uses it.
5. name ← ASK "What is your name?" SHOW "Welcome, " + name
Hint: Type the arrow symbol that stores the answer in the variable.

Spot the Error

Question 1
A SHOW "Your name?" INTO name
B SHOW "Hello, " + name
C SHOW "Nice to meet you!"
Line A — SHOW is an output step and only displays things. To ask the user for a value and store it in name, line 1 should start with ASK.
Question 2
A SHOW "Welcome!"
B ASK "Your name?" INTO name
C SHOW "Hi, " + name
D SHOW "Enjoy the quiz, " + nam
Line D — The answer was stored in a variable called name, but this line uses nam. The variable name must match exactly, so it should be + name.
Question 3
A ASK "Your name? INTO name
B SHOW "Hello, " + name
C SHOW "Welcome to the game!"
Line A — The question text is missing its closing quote mark. It should be ASK "Your name?" INTO name.
Question 4
A ASK "Your name?" INTO name
B ASK "Your age?" INTO age
C SHOW "name" + " is " + age
Line C — Putting name in quotes shows the word name instead of the stored answer. To use the stored value, write name without quotes.
Question 5
A SHOW "Welcome to Cloodit!"
B ASK "Pet name?" INTO pet
C ASK "Your pet is " + pet
Line C — ASK is an input step that waits for the user to type an answer. To display a message on the screen, use SHOW.

Student with a class code? Join your class →