●Field types
A “field type,” which is also referred to as a “data type,” indicates different kinds of stored data. A field type, including numbers and character
strings, is defined within the data which is manipulated while the program
is being run. By defining the field type with a variable, it becomes possible
to assign only the most suitable data, greatly improving the program’s accuracy.
Chapter 7
a
y=
+10
●Arrays
When a large volume of data is manipulated, it becomes useful to employ
a data structure known as an “array” instead of a variable. In contrast to
variables, which store one piece of data, arrays are capable of arranging
and storing multiple pieces of the same type of data. Normally, arrays store
consecutively grouped data. However, they also contain a “subscript” for
identifying individual sets of data, making it possible to search for specific
data and extract smaller pieces of data sequentially from a particular
group.
Variable
Array
Variable
a
Reference
Precautions about arrays
Basic theory
A numeric value
is manipulated.
Before using an array, its size and the
order in which data will be assigned
must be determined beforehand. If
these items are changed thereafter, the
array will need to be redefined.
To distinguish the different elements within an
array, a number known as a subscript is added.
[1]
[2]
[3]
[4]
[5]
Array a
●Lists
A list is a data structure which groups together multiple sets of scattered
data. Similar to arrays, lists do not necessarily store only consecutively
grouped data. In addition to containing the data itself, lists possess a type
of information known as a “pointer,” which indicates the location where
the next set of data is stored. When data is replaced or added, the list’s order can be redefined by changing the pointers.
1
2
2
Data
3
5
4
4
Reference
Other data structures
• Record ∙∙ The data assigned to one
row
• File ∙∙∙∙∙∙∙ A collection of data
5
6
3
Pointer
172