GNVQ
Visual Basic & IT - Unit 6 (Sue Cahill)
mnthIncome(0)
mnthIncome(1)
mnthIncome(2)
--------->.
mnthIncome(11)
(Note that an array starts to number from zero)
An Array may be declared as a static array (the upper and lower bands are known and once set cannot change) or a dynamic array where the upper and lower bands are not always known and can change during the running of the program.
To declare an array is similar to declaring an ordinary variable and in our case may be in the form:-
Dim mnthIncome (11) as integer
The number in parenthesis (brackets) is the upper
band number. Remember that the numbering starts at zero (0)
An alternatively the declaration can be more specific:-
Dim mnthIncome (0 to 11) as integer
The range does not have to start with the lower band at (0).
|
|
|
|