Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 32 additions & 20 deletions courses/fundamentals_of_ada/050_array_types/01-introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,38 @@
Introduction
==============

--------------
Introduction
--------------
-------------------
What Is an Array?
-------------------

* Definition: collection of components of the same type, stored in contiguous memory, and indexed using a discrete range

* Syntax (simplified):

.. container:: latex_environment small

:ada:`type <typename> is array (Index_Type) of Component_Type;`

where

* :dfn:`Index_Type`

- Discrete range of values to be used to access the array components

* :dfn:`Component_Type`

- Type of values stored in the array
- All components are of this same type and size

.. code:: Ada

type Array_T is array (0 .. 3) of Interfaces.Integer_32;

.. image:: array_diagram.svg

---------------
Arrays in Ada
---------------

* Traditional array concept supported to any dimension

Expand All @@ -19,23 +48,6 @@ Introduction
...
Workdays (Mon) := 8.5;

-------------
Terminology
-------------

* :dfn:`Index type`

- Specifies the values to be used to access the array components

* :dfn:`Component type`

- Specifies the type of values contained by objects of the array type
- All components are of this same type

.. code:: Ada

type Array_T is array (Index_T) of Component_T;

------------------------------
Array Type Index Constraints
------------------------------
Expand Down
Loading
Loading