Photo AI
Last Updated Sep 27, 2025
Revision notes with simplified explanations to understand Procedural Programming quickly and effectively.
485+ students studying
Procedural Programming is a programming paradigm based on structured, sequential steps called procedures or functions. It organises code into a series of instructions that are executed in order. Procedural programming languages, like Python, VB.NET, and C, are ideal for tasks with a clear, step-by-step flow. This approach emphasises variables, constants, selection, iteration, subroutines, and more, which we'll explore below.
Variables are named storage locations that hold values which can change during program execution.
For example:
score = 100 # Variable score is assigned the value 100
Constants are named storage locations that hold values which remain the same throughout the program. In Python, constants are typically written in uppercase to signal that they shouldn't change:
Example:
PI = 3.14159 # Constant PI represents the value of pi
In procedural programming, code is executed line-by-line in the order it is written, known as sequence. This linear execution ensures that steps are followed systematically.
Selection allows the program to choose between different paths based on conditions. This is usually implemented with if-else statements.
Example in Python:
age = 18
if age >= 18:
print("You are eligible to vote.")
else:
print("You are not eligible to vote.")
Iteration enables repeating a block of code multiple times until a certain condition is met, often using for and while loops.
Example using a for loop:
for i in range(5):
print("Iteration:", i)
Subroutines are blocks of code that perform specific tasks and can be reused throughout the program. Subroutines in procedural languages are usually created as functions.
Functions: These are subroutines that return a value.
Example:
def add(a, b):
return a + b
Procedures: These perform a task but do not return a value. In Python, a procedure is a function without a return statement.
Using subroutines improves code readability and modularity by breaking down complex tasks into smaller, manageable parts.
String handling allows manipulation of text-based data, such as combining, slicing, or searching within strings.
Example:
text = "Hello, World!"
print(text.lower()) # Outputs: hello, world!
print(text[0:5]) # Outputs: Hello
File handling is the ability to read from and write to external files, which is crucial for persistent data storage.
Example of reading from and writing to a file:
# Writing to a file
with open("example.txt", "w") as file:
file.write("Hello, file!")
# Reading from a file
with open("example.txt", "r") as file:
content = file.read()
print(content) # Outputs: Hello, file!
Boolean Operators: and, or, not – used to form logical expressions.
Example:
is_raining = True
is_cold = False
print(is_raining and is_cold) # Outputs: False
Arithmetic Operators: +, -, *, /, // (integer division), % (modulus), ** (exponentiation) – used for mathematical calculations.
Example:
result = (10 + 5) * 2 # Outputs: 30
Example: Below is a Python example of a simple procedural program that simulates basic banking actions, such as checking a balance and making a deposit or withdrawal.
# Define constants and variables
balance = 1000.00 # Initial balance
# Function to display the balance
def check_balance():
print("Your current balance is:", balance)
# Function to deposit an amount
def deposit(amount):
global balance
balance += amount
print(f"Deposited ${amount}. New balance is: ${balance}")
# Function to withdraw an amount
def withdraw(amount):
global balance
if amount > balance:
print("Insufficient funds!")
else:
balance -= amount
print(f"Withdrew ${amount}. New balance is: ${balance}")
# Main program loop
while True:
print("\\n--- Banking Menu ---")
print("1. Check Balance")
print("2. Deposit")
print("3. Withdraw")
print("4. Exit")
choice = int(input("Enter your choice: "))
if choice == 1:
check_balance()
elif choice == 2:
deposit_amount = float(input("Enter amount to deposit: "))
deposit(deposit_amount)
elif choice == 3:
withdraw_amount = float(input("Enter amount to withdraw: "))
withdraw(withdraw_amount)
elif choice == 4:
print("Exiting program.")
break
else:
print("Invalid choice. Please try again.")
Explanation of the Example:
Enhance your understanding with flashcards, quizzes, and exams—designed to help you grasp key concepts, reinforce learning, and master any topic with confidence!
40 flashcards
Flashcards on Procedural Programming
Revise key concepts with interactive flashcards.
Try Computer Science Flashcards4 quizzes
Quizzes on Procedural Programming
Test your knowledge with fun and engaging quizzes.
Try Computer Science Quizzes29 questions
Exam questions on Procedural Programming
Boost your confidence with real exam questions.
Try Computer Science Questions27 exams created
Exam Builder on Procedural Programming
Create custom exams across topics for better practice!
Try Computer Science exam builder12 papers
Past Papers on Procedural Programming
Practice past papers to reinforce exam experience.
Try Computer Science Past PapersDiscover More Revision Notes Related to Procedural Programming to Deepen Your Understanding and Improve Your Mastery
96%
114 rated
Types of Programming Language
Assembly Language & Little Man Computer
211+ studying
190KViewsJoin 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