Creating an Array: Difference between revisions

m
→‎{{header|Ada}}: syntax highlighting
m (→‎{{header|Ada}}: syntax highlighting)
Line 20:
 
Ada array indices may begin at any value, not just 0 or 1
<Ada>
type Arr is array (Integer range <>) of Integer;
Uninitialized : Arr (1 .. 10);
Line 26 ⟶ 27:
Const : constant Arr := (1 .. 10 => 1, 11 .. 20 => 2, 21 | 22 => 3);
Centered : Arr (-50..50) := (0 => 1, Others => 0);
</ada>
Ada arrays may be indexed by enumerated types, which are discrete non-numeric types
<ada>
type Days is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
type Activities is (Work, Fish);
type Daily_Activities is array(Days) of Activities;
This_Week : Daily_Activities := (Mon..Fri => Work, Others => Fish);
</ada>
 
=={{header|ALGOL 68}}==
Anonymous user