[SparForte][Banner]
[Top Main Menu] Intro | Tutorials | Reference | Packages | Examples | Contributors   [Back Page]      [Next Page]  

Records

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
     name : string;
     address : string;
     balance : float;
     active : boolean;
end 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 );
current_customer : customer := united_snorkels;

To reference the parts of the record, use dot notation.

sushi_express.name := "Sushi Express Inc.";
put_line( sushi_express.name );

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.


 

[Right Submenu]

 AdaScript versus GCC

 Case Sensitivity

 Reserved Words

 Comments

 Literals

 Bourne Shell Word Expansions

 Fundamental Types

 User-defined Types

 Enumerated Types

 Arrays

 Records

 Basic Assignment

 The @ and % Operands

 Command Argument Shortcuts

 Redirection and Pipelines

 Command Line Interaction

 Built-in Shell Commands

 The Current Directory

 Database Commands

 Flow of Control

 Other Statements/ Subprograms

 External Commands

 Block Statements and Subprograms

 TCP/IP Sockets

 Numeric Formatting with Put

 Interpreter Directives

 Command Line Options

 Command Reference

 ASCII and Latin_1 Character Sets

 Common Error Messages

 Common PHP Functions and the SparForte Equivalent

[Back to Top] Back To Top [Small Forte Symbol]