Module Module1 ' addNumsR is a recursive version of a subroutine to add a list of numbers ' addNumsI is an iterative version of a subroutine to add a list of numbers Function addNumsR(ByVal 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 Return numbers(0) + addNumsR(numbers.GetRange(1, upper)) End If End Function Function addNumsI(ByVal numbers As List(Of Integer)) As Integer Dim sum As Integer = 0 Dim num As Integer = 0 For Each num In numbers sum = sum + num Next Return sum End Function Sub Main() Dim eat As String = "" Dim marks = New List(Of Integer) From {3, 6, 2, 8, 1} Dim total As Integer = 0 Console.WriteLine("Recursive routine") total = addNumsR(marks) Console.WriteLine(String.Format("Total: {0}", total)) Console.WriteLine("Iterative routine") total = addNumsI(marks) Console.WriteLine(String.Format("Total: {0}", total)) Console.WriteLine("Any key to continue") eat = Console.ReadLine() End Sub End Module