DavidSCowan
Board Regular
- Joined
- Jun 7, 2009
- Messages
- 78
Hi
I am trying to learn about recursive programs but when I write a really simple one - to sum numbers up to n - I get #VALUE! error. Can someone please tell me what i am doing wrong.
Function mySum
Dim n As Integer
Dim result As Integer
If n <= 1 Then
result = 1
Else: result = n + mySum(n - 1)
End If
mySum
= result
End Function
Thank you
I am trying to learn about recursive programs but when I write a really simple one - to sum numbers up to n - I get #VALUE! error. Can someone please tell me what i am doing wrong.
Function mySum

Dim n As Integer
Dim result As Integer
If n <= 1 Then
result = 1
Else: result = n + mySum(n - 1)
End If
mySum

End Function
Thank you