You are on page 1of 1

Module prgm1

Sub Main()
Dim vala(10) As Integer
Dim refb(10) As Integer
Call arrayvalref(vala, refb)
Console.WriteLine("Display using BYVAL")
Console.WriteLine(UBound(vala))
Console.WriteLine("Display using BYREF")
Console.WriteLine(UBound(refb))
End Sub
Private Sub arrayvalref(ByVal arr1() As Integer, ByRef arr2() As Integer)
ReDim arr1(100)
ReDim arr2(100)
End Sub
End Module

Module Module1
Sub Main()
Console.WriteLine(sum(1, 2, 3, 4))
Console.WriteLine(sum(1, 2, 3))
Console.WriteLine(sum(1.1, 2.2))
End Sub
Function sum(ByVal ParamArray a() As Object) As Object
Dim ret As Object = 0
Dim i As Object
For i = 0 To UBound(a)
ret += a(i)
Next
Return ret
End Function
End Module

You might also like