What is a Record?
A record is a data structure that groups related data items of different types under one name. Each item in a record is called a field and has its own name and data type.
Unlike arrays (which store items of the same type), records can mix integers, strings, booleans, and reals in one structure.
| Structure | Element access | Types of data | Use case |
| Array | Index (e.g. scores[0]) | All the same type | List of similar items |
| Record | Field name (e.g. student.name) | Mixed types allowed | Grouped related data |
Declaring a Record in AQA
AQA does not have a specific keyword for records in pseudo-code, but you can represent them conceptually. The idea is that a record has named fields:
// Conceptual record definition — "Student" with 3 fields
// Field: name (String), age (Integer), isPassing (Boolean)
student.name ← "Alice"
student.age ← 15
student.isPassing ← True
OUTPUT student.name // "Alice"
OUTPUT student.age // 15
Accessing and Updating Fields
You access a record's field using dot notation: recordName.fieldName
product.name ← "Laptop"
product.price ← 799.99
product.stock ← 50
// Update a field
product.stock ← product.stock - 1
OUTPUT product.name + " costs £" + str(product.price)
Arrays of Records
A powerful pattern is an array of records — you can store multiple records in an array, then access each one by index and each field by name.
// Array of student records (index 0 to 2)
students[0].name ← "Alice"
students[0].age ← 15
students[1].name ← "Bob"
students[1].age ← 16
students[2].name ← "Cara"
students[2].age ← 15
// Print all student names with a loop
FOR i ← 0 TO 2
OUTPUT students[i].name
ENDFOR
Worked Example — Library System
// Book record: title, author, pages, isAvailable
books[0].title ← "Python Basics"
books[0].author ← "J. Smith"
books[0].pages ← 320
books[0].isAvailable ← True
books[1].title ← "Data Structures"
books[1].author ← "K. Lee"
books[1].pages ← 450
books[1].isAvailable ← False
// Check out a book
IF books[0].isAvailable == True THEN
books[0].isAvailable ← False
OUTPUT "Book checked out"
ELSE
OUTPUT "Not available"
ENDIF
Exam tip: Records and arrays are both data structures, but records group related data of different types using field names, while arrays store multiple values of the same type using integer indices. Know the difference and when to use each.
⚠️ Common Mistakes
- Confusing array index with field name — it's students[0].name not students["name"][0]
- Forgetting that arrays are zero-indexed — first record is at index 0
- Trying to store different data types in a plain array (use a record instead)