← ACARA Digital Technologies Years 7–8

Turning pseudocode or a flowchart into JavaScript

Translates the pseudocode step SET score TO 0. Each step of pseudocode or a flowchart becomes one JavaScript statement: ask is prompt, a decision diamond is if, a loop arrow is while.

Understanding Turning pseudocode or a flowchart into JavaScript in ACARA Digital Technologies Years 7–8

What it does: SET means store a value in a variable, which JavaScript does with let, a name, = and the value. The yes/no question in a diamond becomes the condition in brackets after if. The yes path goes inside the braces. ASK means getting input from the user, so it becomes prompt(). console.log() only displays output. An arrow that goes back to the diamond means repeat, so use a loop. An if runs its code only once. The condition must use the comparison >= to match the pseudocode. A single = assigns a value and does not compare. Run the program and follow the flowchart step by step to see if the results match. Line count does not prove it is correct.

Common mistakes: The pseudocode step SET score TO 0 is an assignment, so it needs a single = sign. The == symbol compares values and cannot be used to create a variable. It should be let score = 0;. A parallelogram or PRINT step that shows output becomes console.log() in JavaScript. There is no print() function here. It should be console.log(name, age);.

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 599–610) and word search (Modules 583–613).

Take this worksheet further — free with Cloodit

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

Learning
Duo
The pseudocode step is: SET score TO 0. Which JavaScript statement matches it?
let score = 0;score == 0;
Matches
if (score = 10) {
↓
The diamond asks 'Is score equal to 10?' but the code uses = which assigns a value. It should use === to compare.
Applying
Meanings
Term
let score = 0;
Meaning
Translates the pseudocode step SET score TO 0. Each step of pseudocode or a flowchart becomes one JavaScript statement: ask is prompt, a decision diamond is if, a loop arrow is while.
Practice
let score = 0;
Testing
Gaps
score = 0;
Check Answer
Spots
1let score == 0;
2score = score + 5;

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

The 'Puffin' badge — Definition Diver, 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. The pseudocode step is: SET score TO 0. Which JavaScript statement matches it?
A. let score = 0; ✓
B. score == 0;
SET becomes let (with =) to create a variable and give it a starting value. == only compares values.
2. The pseudocode step is: ASK 'What is your name?' and store it in name. Which JavaScript matches?
A. let name = console.log('What is your name?');
B. let name = prompt('What is your name?'); ✓
ASK means getting input from the user, so it becomes prompt(). console.log() only displays output.
3. In a flowchart, a diamond shape asks a yes/no question such as 'Is age >= 13?'. Which JavaScript does it become?
A. if (age >= 13) { ... } ✓
B. let (age >= 13) { ... }
A decision diamond becomes an if statement (or a while loop if an arrow goes back). let only creates variables.
4. A flowchart has a parallelogram labelled 'OUTPUT total'. Which JavaScript matches?
A. prompt(total);
B. console.log(total); ✓
A parallelogram is input or output. OUTPUT becomes console.log(), while INPUT becomes prompt().
5. A flowchart diamond 'Is count < 5?' has a Yes path that returns to the diamond after adding 1 to count. Which JavaScript shows this?
A. while (count < 5) { count++; } ✓
B. if (count < 5) { count++; }
An arrow that goes back to the diamond means repeat, so use a loop. An if runs its code only once.

Match the Pairs

let age = prompt("Enter your age"); → Translates a parallelogram input step: INPUT age. The answer from the user is stored in the variable age.
while (lives > 0) { → Translates a decision diamond with an arrow looping back: while lives is more than 0, repeat the steps inside.
The pseudocode step SET total TO 0 becomes a variable declaration with let. → let total = 0;
A decision diamond that asks 'Is score >= 10?' becomes an if statement with the same condition. → if (score >= 10) {
if (score = 10) { → The diamond asks 'Is score equal to 10?' but the code uses = which assigns a value. It should use === to compare.
let name = console.log("Enter your name"); → The pseudocode step ASK for name is an input, so it should use prompt(), not console.log(), which only displays output.

Key Term

let score = 0;
Translates the pseudocode step SET score TO 0. Each step of pseudocode or a flowchart becomes one JavaScript statement: ask is prompt, a decision diamond is if, a loop arrow is while.

Fill in the Blanks

1. // SET score TO 0 let score = 0;
Hint: Type the keyword that creates a variable, matching the SET step.
2. // ASK "Your name?" let name = prompt("Your name?");
Hint: Type the function that shows a question box and returns what the user types.
3. if (score > 10) { console.log("Well done!"); }
Hint: Type the keyword that a decision diamond with a yes or no answer becomes.
4. while (lives > 0) { lives--; }
Hint: Type the comparison operator for the flowchart condition: lives is greater than zero.
5. let total = 5 + 3; console.log(total);
Hint: Type the statement that matches an output parallelogram showing a value.

Spot the Error

Question 1
A let score == 0;
B score = score + 5;
C console.log(score);
Line A — The pseudocode step SET score TO 0 is an assignment, so it needs a single = sign. The == symbol compares values and cannot be used to create a variable. It should be let score = 0;
Question 2
A let name = prompt("Name?");
B let age = prompt("Age?");
C print(name, age);
Line C — A parallelogram or PRINT step that shows output becomes console.log() in JavaScript. There is no print() function here. It should be console.log(name, age);
Question 3
A let mark = 72;
B if mark >= 50 {
C console.log("Pass");
D }
Line B — A decision diamond becomes an if statement, and the condition must be inside round brackets. It should be if (mark >= 50) {
Question 4
A let city = ask("City?");
B console.log("Hi " + city);
C console.log(city.length);
Line A — The pseudocode word ASK becomes prompt() in JavaScript. ask() is not a JavaScript function. It should be let city = prompt("City?");
Question 5
A let count = 1;
B repeat (count <= 3) {
C console.log(count);
D count++;
E }
Line B — A flowchart arrow that loops back while a condition is true becomes a while loop. repeat is not a JavaScript keyword. It should be while (count <= 3) {

Student with a class code? Join your class →