Records are a composite type, like arrays, except that the components are named. Like "structs" in the C language, records act like a group of variables collected under a single name. The components can be of different types. Records can serve as tables or help to declare and manage related information.
Unlike arrays, records contain values of different types. There are no anonymous record types: all must be declared with a name.
SparForte has limited support for record types and record variables.
Before you declare a record, create a record type describing the group of variables a record will represent.
type customer is record
This type describes a record containing five variables (or "fields").
To create a record variable, use this type.
sushi_express : customer;
You can assign initial values when you declare the variable. Provide a value for each component in the record.
united_snorkels : customer := ("United Snorkels", "555 Snorkel
Street", 9456.45, true );
To reference the parts of the record, use dot notation.
sushi_express.name := "Sushi Express Inc.";
SparForte supports only a small subset of GCC Ada's record features. Assigning records to records is only supported in declarations.
Ada: Null records, variant records, records containing arrays or other records are not yet implemented. Assignment with other not yet implemented.
|Back To Top|