Skip to content

Commit 54859ae

Browse files
Merge branch 'slides/121-create-svg-diagram-to-show-what-an-array-looks-like' into 'master'
Resolve "Create SVG diagram to show what an array looks like" Closes #121 See merge request feng/training/material!227
2 parents 5df3543 + 8f288a6 commit 54859ae

File tree

3 files changed

+444
-23
lines changed

3 files changed

+444
-23
lines changed

courses/fundamentals_of_ada/050_array_types/01-introduction.rst

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,38 @@
22
Introduction
33
==============
44

5-
--------------
6-
Introduction
7-
--------------
5+
-------------------
6+
What Is an Array?
7+
-------------------
8+
9+
* Definition: collection of components of the same type, stored in contiguous memory, and indexed using a discrete range
10+
11+
* Syntax (simplified):
12+
13+
.. container:: latex_environment small
14+
15+
:ada:`type <typename> is array (Index_Type) of Component_Type;`
16+
17+
where
18+
19+
* :dfn:`Index_Type`
20+
21+
- Discrete range of values to be used to access the array components
22+
23+
* :dfn:`Component_Type`
24+
25+
- Type of values stored in the array
26+
- All components are of this same type and size
27+
28+
.. code:: Ada
29+
30+
type Array_T is array (0 .. 3) of Interfaces.Integer_32;
31+
32+
.. image:: array_diagram.svg
33+
34+
---------------
35+
Arrays in Ada
36+
---------------
837

938
* Traditional array concept supported to any dimension
1039

@@ -19,23 +48,6 @@ Introduction
1948
...
2049
Workdays (Mon) := 8.5;
2150
22-
-------------
23-
Terminology
24-
-------------
25-
26-
* :dfn:`Index type`
27-
28-
- Specifies the values to be used to access the array components
29-
30-
* :dfn:`Component type`
31-
32-
- Specifies the type of values contained by objects of the array type
33-
- All components are of this same type
34-
35-
.. code:: Ada
36-
37-
type Array_T is array (Index_T) of Component_T;
38-
3951
------------------------------
4052
Array Type Index Constraints
4153
------------------------------

0 commit comments

Comments
 (0)