Stores multiple values of the SAME type e.g. [85, 72, 91] — all integers
RECORD
Stores multiple values of DIFFERENT types about one entity e.g. a student: name, age, score
Example:A student record could store: name (String), age (Integer), score (Real)
Defining a Record in AQA Pseudocode
Record Structure
RECORD Student name: String age: Integer score: Real END RECORD
student1 ← Student('Ahmed', 16, 87.5)
OUTPUT student1.name ← 'Ahmed'
student1.score ← 90.0
Field access:Use dot notation — recordName.fieldName
Records in Arrays
Storing Multiple Records
RECORD Student name: String score: Integer END RECORD
class ← [Student('Ali',85), Student('Beth',72), Student('Carlos',91)]
FOR i ← 0 TO 2 OUTPUT class[i].name + ': ' + STR(class[i].score) ENDFOR
An array of records lets you store a collection of complex objects — like a class register or product inventory.
Exam Practice
Have a go at this question
AQA-style question
A library stores book data. Define a record called Book with fields: title (String), author (String) and pages (Integer). Show how to create a Book record for "Harry Potter" by "J.K. Rowling" with 300 pages, then output its title.
4 marks
RECORD Book title: String author: String pages: Integer END RECORD b ← Book('Harry Potter', 'J.K. Rowling', 300) OUTPUT b.title
Key Takeaways
What to Remember
Records store multiple fields of different data types about one thing
Define with RECORD … END RECORD; each field has a name and type
Access fields with dot notation: record.field
Arrays of records let you store many complex objects together