Arrays
From Apache OpenOffice Wiki
Apache OpenOffice
==
==
Dim MyArray(3)
MyArray(0)MyArray(1)MyArray(2)MyArray(3)
Dim MyInteger(3) As Integer
Dim MyInteger(5 To 10) As Integer
Dim MyInteger(-10 To -5) As Integer
Dim s(-53000 to 89000) As String
s(-52000) = "aa"
s(79999) = "bb"
print s(-52000), s(79999)
==
Option Base 1
Apache OpenOffice
Option Base 1
Option Base 1
' ...
Dim MyInteger(3)
MyInteger(1)MyInteger(2)MyInteger(3)MyInteger(4)
![]() |
Apache OpenOfficeOption Base 1Apache OpenOfficeMyInteger(3)Apache OpenOfficeOption CompatibleApache OpenOffice |
==
Apache OpenOffice
Dim MyIntArray(5, 5) As Integer
=
Apache OpenOffice
==
Apache OpenOffice
ReDim MyArray(10)
Dim MyArray(4) As Integer ' Declaration with five elements
' ...
ReDim MyArray(10) As Integer ' Increase to 11 elements
' ...
ReDim MyArray(20) As Integer ' Increase to 21 elements
Preserve
Dim MyArray(10) As Integer ' Defining the initial
' dimensions
' ...
ReDim Preserve MyArray(20) As Integer ' Increase in
' data field, while
' retaining content
Preserve
ReDimPreserve
==
Dim MyArray(10) As Integer
' ... some instructions
Dim n As Integer
n = 47 ' could be the result of a computation
Redim MyArray(n) As Integer
MsgBox(LBound(MyArray)) ' displays : 0
MsgBox(UBound(MyArray)) ' displays : 47
Dim MyArray(10, 13 to 28) As Integer
MsgBox(LBound(MyArray, 2)) ' displays : 13
MsgBox(UBound(MyArray, 2)) ' displays : 28
==
Dim s() As String ' declare an empty array
' --- later in the program ...
Redim s(13) As String
Dim MyArray() As Integer
MsgBox(LBound(MyArray)) ' displays : 0
MsgBox(UBound(MyArray)) ' displays : -1
==
=
==
==
=
Content on this page is licensed under the Public Documentation License (PDL). |