|
VMS Help ADA, Language Topics, Aggregates *Conan The Librarian |
An aggregate is a basic operation that combines array or record
component values into one composite value. Each component value
associates an expression with an array or record component.
Component associations may be named or positional.
The choice 'others' is allowed as the last association in
an aggregate; it specifies a value for all of the remaining
components.
Examples of array aggregates:
-- Initialize an array variable:
TEXT_LINE: LINE => (others => ' ');
-- First named association, then positional:
TABLE1 := TABLE'(1 | 3 | 5 => 5, others => 0);
TABLE2 := TABLE'(1,2,3,4,5,6,7,8,9,10);
Examples of record aggregates:
-- Initialize a record variable using named association:
TODAY: DATE := (DAY => 14,
MONTH => September,
YEAR => 1992);
-- Assign a record value using positional association:
OBJECT := ('A', 5, "Summer is a...");
-- Assign a record value using named association:
THIS_ELEMENT.NEXT := new LIST_ELEMENT'(CLASS => ELEMENT,
NEXT => null,
ELEMENT_VALUE => I);
|
|