Photo AI
Last Updated Sep 27, 2025
Revision notes with simplified explanations to understand Functions and Procedures quickly and effectively.
493+ students studying
Functions and procedures are key components of modular programming. They allow developers to organise code into smaller, reusable blocks. Although both serve similar purposes, there are important differences in how they operate and are used.
Understanding how to define, use, and trace functions and procedures is essential for writing efficient, modular, and maintainable code.
Example in Pseudocode:
FUNCTION calculateArea(radius)
RETURN 3.14 * radius * radius
END FUNCTION
Example in Python:
def calculate_area(radius):
return 3.14 * radius * radius
Example in Pseudocode:
PROCEDURE displayMessage()
PRINT "Hello, World!"
END PROCEDURE
Example in Python:
def display_message():
print("Hello, World!")
Aspect | Functions | Procedures |
---|---|---|
Return Value | Returns a value using RETURN . | Does not return a value. |
Usage | Used to perform calculations or tasks that need a result. | Used to execute tasks like displaying output. |
Integration | Often used within expressions or other functions. | Typically called as standalone statements. |
Example Usage | result = calculateArea(5) | displayMessage() |
Functions and procedures can work together to build modular, efficient programs.
Function to Calculate Average:
FUNCTION calculateAverage(marks)
total = 0
FOR EACH mark IN marks
total = total + mark
ENDFOR
RETURN total / LENGTH(marks)
END FUNCTION
Procedure to Display Result:
PROCEDURE displayResult(name, average)
PRINT "Student:", name
PRINT "Average Mark:", average
END PROCEDURE
Main Program:
MAIN
marks = [85, 90, 78]
average = calculateAverage(marks)
displayResult("Alice", average)
END MAIN
Pseudocode:
FUNCTION square(x)
RETURN x * x
END FUNCTION
PROCEDURE printSquare(value)
result = square(value)
PRINT result
END PROCEDURE
MAIN
printSquare(3)
END MAIN
Trace Table:
Step | Function/Procedure | Input | Output | Result |
---|---|---|---|---|
1 | square(3) | 3 | 9 | 9 |
2 | printSquare(3) | 3 | Prints 9 | - |
calculateArea()
or findMaximum()
can handle repetitive calculations.displayMenu()
or printErrorMessage()
manage user interactions.RETURN
statement in a procedure or failing to return a value from a function.Enhance your understanding with flashcards, quizzes, and exams—designed to help you grasp key concepts, reinforce learning, and master any topic with confidence!
80 flashcards
Flashcards on Functions and Procedures
Revise key concepts with interactive flashcards.
Try Computer Science Flashcards8 quizzes
Quizzes on Functions and Procedures
Test your knowledge with fun and engaging quizzes.
Try Computer Science Quizzes29 questions
Exam questions on Functions and Procedures
Boost your confidence with real exam questions.
Try Computer Science Questions27 exams created
Exam Builder on Functions and Procedures
Create custom exams across topics for better practice!
Try Computer Science exam builder12 papers
Past Papers on Functions and Procedures
Practice past papers to reinforce exam experience.
Try Computer Science Past PapersDiscover More Revision Notes Related to Functions and Procedures to Deepen Your Understanding and Improve Your Mastery
Join 500,000+ A-Level students using SimpleStudy...
Join Thousands of A-Level Students Using SimpleStudy to Learn Smarter, Stay Organized, and Boost Their Grades with Confidence!
Report Improved Results
Recommend to friends
Students Supported
Questions answered