← IGCSE Computer Science Paper 2

Calling a procedure with a value

CALL runs the procedure Line and passes the value 60 in brackets into its parameter. A variable can be passed too, e.g. CALL Line(MySize). Different values give different results.

Understanding Calling a procedure with a value in IGCSE Computer Science Paper 2

What it does: Changing the value in the brackets changes what the parameter receives, so the output changes, unlike CALL Line(60). Different values passed in give different results, for example a short line for 20 and a longer line for 80. A variable in the brackets passes the value it currently holds, not its name. A CALL inside a loop runs every time the loop repeats, so Line runs 3 times here.

Common mistakes: A procedure is run with the CALL keyword. The line must be CALL Line(60), not just Line(60). The value being passed must be inside brackets after the procedure name. It should be CALL Line(MySize).

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 399–408) and word search (Modules 399–418).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which line correctly calls the procedure Line and passes the value 60?
CALL Line(60)Line 60
Matches
Line(60)
↓
The word CALL is missing, so the procedure is not called correctly. It should be CALL Line(60).
Applying
Meanings
Term
CALL Line(60)
Meaning
CALL runs the procedure Line and passes the value 60 in brackets into its parameter. A variable can be passed too, e.g. CALL Line(MySize). Different values give different results.
Practice
MySize ← 40
Testing
Gaps
Line(60)
Check Answer
Spots
1Line(60)
2CALL Line(90)

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

The 'Snow Leopard' badge — Silent Debugger, 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 line correctly calls the procedure Line and passes the value 60?
A. CALL Line(60) ✓
B. Line 60
A procedure call starts with CALL, then the procedure name, then the value in brackets.
2. Which line passes the variable MySize into the procedure Line?
A. CALL Line MySize
B. CALL Line(MySize) ✓
The variable name goes inside brackets, just like a number. The value stored in MySize is what gets passed.
3. PROCEDURE Line(Size : INTEGER) is called with CALL Line(60). What happens to the parameter Size?
A. Size takes the value 60 inside the procedure ✓
B. Size stays empty and 60 is ignored
The value in the brackets of the CALL is passed into the parameter, so Size holds 60 while the procedure runs.
4. A program runs CALL Line(20) and later CALL Line(80). What is the result?
A. The same procedure runs, but with different results because the values differ ✓
B. Both calls give exactly the same result because it is the same procedure
Different values passed in give different results, for example a short line for 20 and a longer line for 80.
5. After MySize ← 45, the line CALL Line(MySize) runs. Which value is passed into the parameter?
A. The text MySize
B. 45, the value stored in MySize ✓
A variable in the brackets passes the value it currently holds, not its name.

Match the Pairs

CALL Line(60) → Runs the procedure Line and passes the value 60 into its parameter.
CALL Line(MySize) → Runs the procedure Line and passes the current value stored in the variable MySize into its parameter.
Calling the same procedure with a different value gives a different result, for example a shorter line. → CALL Line(20)
A procedure can be called in a loop so that each pass sends a new value into the parameter. → FOR Count ← 1 TO 3 CALL Line(Count * 10) NEXT Count
Line(60) → The word CALL is missing, so the procedure is not called correctly. It should be CALL Line(60).
CALL Line 60 → The value is not in brackets. It should be CALL Line(60).

Key Term

CALL Line(60)
CALL runs the procedure Line and passes the value 60 in brackets into its parameter. A variable can be passed too, e.g. CALL Line(MySize). Different values give different results.

Fill in the Blanks

1. CALL Line(60)
Hint: Type the keyword that runs a procedure and passes a value into it.
2. CALL Line(60)
Hint: Type the name of the procedure being called.
3. MySize ← 40 CALL Line(MySize)
Hint: Type the variable whose value is passed into the parameter.
4. FOR Count ← 1 TO 3 CALL Line(Count) NEXT Count
Hint: Type the loop variable so a different value is passed each time round.
5. FOR Count ← 1 TO 3 CALL Line(10) NEXT Count
Hint: Type the keyword that calls the procedure on each pass of the loop.

Spot the Error

Question 1
A Line(60)
B CALL Line(90)
C OUTPUT "Done"
Line A — A procedure is run with the CALL keyword. The line must be CALL Line(60), not just Line(60).
Question 2
A MySize ← 40
B CALL Line MySize
C OUTPUT "Finished"
Line B — The value being passed must be inside brackets after the procedure name. It should be CALL Line(MySize).
Question 3
A DECLARE MySize : INTEGER
B MySize ← 25
C CALL Line("MySize")
Line C — The quotes turn the variable name into a piece of text. To pass the value stored in the variable, write CALL Line(MySize) with no quotes.
Question 4
A FOR Count ← 1 TO 3
B CALL Line[Count * 20]
C NEXT Count
Line B — The value passed to a procedure goes in round brackets, not square brackets. It should be CALL Line(Count * 20).
Question 5
A FOR Count ← 1 TO 4
B OUTPUT "Drawing"
C CALL Line(Size * 10)
D NEXT Count
Line C — Size does not exist in this program, so there is no value to pass. The loop variable is Count, so the call should be CALL Line(Count * 10).

Student with a class code? Join your class →