Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Sub Main()
- Dim result As Integer = CountDown(10)
- Console.WriteLine("Result: " & result)
- End Sub
- Function CountDown(n As Integer) As Integer
- ' Base case: when n equals 0, return 0
- If n = 0 Then
- Return 0
- Else
- ' Recursive case: but we mistakenly increment n instead of decrementing
- Return CountDown(n + 1)
- End If
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment