Domino Code Fragment

Code Name*
Add together two one-dimensional arrays!
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.138.122.195
Description*
Takes two arrays and builds them into one.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
This assumes that both arrays start at element (0), use Lbound and change code accordingly if it does not.
Files/Graphics attachments (if applicable): Code:
This is pass by reference, FirstArray will contain all the elements of FirstArray and
SecondArray.

Sub addarrays (FirstArray As Variant, SecondArray As Variant)
Dim y As Integer
Dim x As Integer
Dim z As Integer
y = Ubound(FirstArray)
'Upper limits of FirstArray
x = Ubound(SecondArray)
'Upper limits of SeondArray
If (x > 0 Or SecondArray(0) <> "") Then
'Exit if there are no elements in SecondArray
If x = 0 And y = (0) And FirstArray(0) = "" Then
'See if first Element of FirstArray is empty and only one element in SecondArray
FirstArray(0) = SecondArray(0)
'Put first Element of SecondArray into first element of FirstArray
Exit Sub
'End Sub
End If
If (x > 0 And y = 0 And FirstArray(0) = "") Then
'FirstArray is empty so redim without preserving it
Redim FirstArray(x)

Else
z = (x + y) + 1
'Add bounds together to get new upper bound of FirstArray add one for zero element
Redim Preserve FirstArray(z)
'Redim Preserve FirstArray to new upperbound
y = y + 1
'Add one to y to start at one higher than old upperbound of FirstArray
End If
For i = 0 To x
'Loop through SecondArray and put its element in FirstArray
FirstArray(y) = SecondArray(i)
y = y + 1
'Add one to y to step through FirstArray
Next i
End If
End Sub