Module Module1 ' recursive routine to sum a list of numbers Function addNums(ByRef numbers As List(Of Integer)) As Integer Dim upper As Integer = 0 If (numbers.Count() = 1) Then Return numbers(0) Else ' Find all items except the first one upper = numbers.Count() - 1 numbers(0) = numbers(0) + addNums(numbers.GetRange(1, upper)) Console.WriteLine(String.Format("{0}", numbers(0))) End If Return numbers(0) End Function Function addNums2(ByRef numbers As List(Of Integer)) As Integer Dim upper As Integer = 0 If (numbers.Count() > 1) Then upper = numbers.Count() - 1 numbers(0) = numbers(0) + addNums2(numbers.GetRange(1, upper)) End If 'Console.WriteLine(String.Format("{0}", numbers(0))) Return numbers(0) End Function Sub Main() Dim eat As String = "" Dim marks = New List(Of Integer) From {3, 6, 2, 8} Dim marks2 = New List(Of Integer) From {3, 6, 2, 8} Dim total As Integer = 0 Console.WriteLine("List of 4 numbers 3,6,2,8") total = addNums(marks) Console.WriteLine(String.Format("Total v1 = {0}", total)) total = addNums2(marks2) Console.WriteLine(String.Format("Total v2 = {0}", total)) Console.WriteLine("Any key to continue") eat = Console.ReadLine() End Sub End Module