Records (AQA GCSE Computer Science) : Revision Note
Records
What is a record?
A record is a way to group together different types of data about one item
It is a custom structure , it stores multiple related fields all in one place
Unlike an array (which only stores one type of data), a record can store different types (like strings, numbers, and decimals) in the same structure
Examiner Tips and Tricks
Records in programming are a type of data structure used to group related data in your code
These are not the same as records in a database, which refer to a complete set of fields on a single entity in a table (row)
Example: A car record
RECORD Car
make : String
model : String
reg : String
price : Real
noOfDoors : Integer
ENDRECORD
This record structure groups together all the information about one car
Each field has a name and a data type
DECLARE myCar : Car
myCar.make ← "Toyota"
myCar.model ← "Yaris"
myCar.reg ← "AB12 XYZ"
myCar.price ← 5995.99
myCar.noOfDoors ← 5
myCar
is one instance of theCar
recordYou can access each field using dot notation (e.g.
myCar.make
)
You've read 0 of your 5 free revision notes this week
Sign up now. It’s free!
Did this page help you?