RosettaCodeData/Task/Array-concatenation/FreeBASIC/array-concatenation.basic

27 lines
713 B
Plaintext

' FB 1.05.0 Win64
Sub ConcatArrays(a() As String, b() As String, c() As String)
Dim aSize As Integer = UBound(a) - LBound(a) + 1
Dim bSize As Integer = UBound(b) - LBound(b) + 1
Dim cSize As Integer = aSize + bSize
Redim c(0 To cSize - 1)
Dim i As Integer
For i = 0 To aSize - 1
c(i) = a(LBound(a) + i)
Next
For i = 0 To bSize - 1
c(UBound(a) + i + 1) = b(LBound(b) + i)
Next
End Sub
Dim a(3) As String = {"The", "quick", "brown", "fox"}
Dim b(4) As String = {"jumped", "over", "the", "lazy", "dog"}
Dim c() As String
ConcatArrays(a(), b(), c())
For i As Integer = LBound(c) To UBound(c)
Print c(i); " ";
Next
Print : Print
Print "Press any key to quit the program"
Sleep