Once a array is defined you can start accessing it. Remember in order for a array to be useful you will need to store data into it at some point. This may be done through a user interface or done in code.

Array

Position

1

2

3

4

Names array

5

Value

Bert

Fiona

Sally

George

Fred

Array

Position

1

2

3

4

Test1 array

5

Value

8

5

7

7

5

Array

Position

1

2

3

4

Test2 array

5

Value

3

7

6

7

4

To change the a element in a array you use the assignment operator. For example to change the name "Fred" to "Fred Flintstone" we write the code

Names(5) = "Fred Flintstone"

We can access the contents of the array to display a test score for Sally simply by the code –

MsgBox( test1(3) )

To find out what test "Bert" did best on we could write the code

If test1(1) > test2(1) then

Msgbox(names(1) + "did better on test 1")

Else if test(1) < test2(1) then

Msgbox(names(1) +"did better on test 2")

Else

Msgbox(names(1) + " did the same on both tests")

End if

In order to access a element in a array you simply put the name of the array and then the position you want to access.