← ACARA Digital Technologies Years 7–8

Naming functions with verbs

A function name is a camelCase verb phrase that says what the function does, like calculateTotal or printMenu. Start with a verb, make it meaningful and use no spaces.

Understanding Naming functions with verbs in ACARA Digital Technologies Years 7–8

What it does: checkPassword begins with the verb check, which shows the action the function performs. getHighScore joins the words together with no spaces and capitalises High and Score, which is camelCase. Meaningful names describe the job. doStuff could mean anything, but checkWinner tells you exactly what happens. camelCase starts with a lowercase letter, then each new word starts with a capital letter: getUserName. No underscores are needed. Short names like x do not explain the action. A verb phrase like convertTemperature makes the code easy to read. calculateTotal is a camelCase verb phrase that tells the reader what the function does. printMenu starts with a verb, is meaningful and has no spaces, so it matches the naming rule.

Common mistakes: A function name cannot contain spaces. Write the words together in camelCase: addScores. Function names use camelCase, not underscores. It should be printMenu, which also matches the call on line 4.

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 611–623) and word search (Modules 583–613) and word search (Modules 611–634).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which is the better name for a function that adds up a shopping bill?
calculateTotaltotal
Matches
function calculate total(price, qty) {
↓
The function name has a space in it, so JavaScript sees two separate words. Use calculateTotal instead.
Applying
Meanings
Term
calculateTotal
Meaning
A function name is a camelCase verb phrase that says what the function does, like calculateTotal or printMenu. Start with a verb, make it meaningful and use no spaces.
Practice
function calculateTotal(price, qty) {
Testing
Gaps
calculateTotal(a, b) {
Check Answer
Spots
1let score1 = 5;
2function add Scores(a, b) {

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

The 'Nautilus' badge — Default Expert, 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 is the better name for a function that adds up a shopping bill?
A. calculateTotal ✓
B. total
A function does something, so its name starts with a verb. calculateTotal tells you the action; total sounds like a variable.
2. Which function name is written correctly in JavaScript?
A. print menu
B. printMenu ✓
Function names cannot contain spaces. Join the words and use camelCase: printMenu.
3. Which name starts with a verb?
A. drawSquare ✓
B. squareDrawing
drawSquare starts with the verb draw, so it says what the function does. squareDrawing starts with a noun and is less clear.
4. A function checks if a player has won. Which name is more meaningful?
A. checkWinner ✓
B. doStuff
Meaningful names describe the job. doStuff could mean anything, but checkWinner tells you exactly what happens.
5. Which function name uses camelCase correctly?
A. GetUsername_Now
B. getUserName ✓
camelCase starts with a lowercase letter, then each new word starts with a capital letter: getUserName. No underscores are needed.

Match the Pairs

function calculateTotal(price, qty) { → A good function name: it starts with the verb calculate and clearly says the function works out a total.
function printMenu() { → A good function name: it starts with the verb print and names what is printed, the menu.
Start a function name with a verb so it describes an action → function checkPassword(pass) {
Write the function name in camelCase with no spaces, capitalising each new word after the first → function getHighScore() {
function calculate total(price, qty) { → The function name has a space in it, so JavaScript sees two separate words. Use calculateTotal instead.
function x(a, b) { → The name x is not meaningful and has no verb. A better name would be addNumbers.

Key Term

calculateTotal
A function name is a camelCase verb phrase that says what the function does, like calculateTotal or printMenu. Start with a verb, make it meaningful and use no spaces.

Fill in the Blanks

1. function calculateTotal(a, b) { return a + b; }
Hint: Type the keyword that declares a function before its camelCase verb name.
2. function showScore() { console.log(10); } showScore();
Hint: Type the full function name, starting with a verb, so the call matches the declaration above.
3. function calculateTotal(a, b) {return a+b;} let total = calculateTotal(5, 3);
Hint: Type the second word of the camelCase name, with a capital letter and no space. It says what is being calculated.
4. function calculateArea(w, h) {return w*h;} calculateArea(3, 4);
Hint: Type the verb that starts the function name. It matches the call on the next line and tells what the function does.
5. function printMenu() { console.log("Hi"); } printMenu();
Hint: Type the whole camelCase name, with a verb first and no spaces. It must match the name used in the call below.

Spot the Error

Question 1
A let score1 = 5;
B function add Scores(a, b) {
C return a + b;
D }
Line B — A function name cannot contain spaces. Write the words together in camelCase: addScores.
Question 2
A function print_menu() {
B console.log('Pizza');
C }
D printMenu();
Line A — Function names use camelCase, not underscores. It should be printMenu, which also matches the call on line 4.
Question 3
A let player = 'Mia';
B let level = 3;
C function level(n) {
D console.log(n);
E }
F showLevel(level);
Line C — The name 'level' is a noun and does not say what the function does. Start with a verb: showLevel.
Question 4
A let price = 20;
B function ApplyDiscount(p) {
C return p * 0.9;
D }
Line B — camelCase names start with a lowercase letter. It should be applyDiscount.
Question 5
A function isAdult(age) {
B return age >= 18;
C }
D console.log(isadult(20));
Line D — The call must use the exact camelCase name. isadult is not defined; it should be isAdult with a capital A.

Student with a class code? Join your class →