Hi There,
I have a problem with a simple recursive function.
It works only for number <= 21.
When I debug I see the correct value getting returned but it seems that he also returns null for the first stacked function-call.
Maybe I'm overlooking something obvious ?
Sub CalculateSoul(p_datum)
For t = 0 To StrLength(p_datum)-1
l_nr = l_nr + SubString(p_datum,t,1)
Next
If l_nr <= 21 Then
Return l_nr
Else
CalculateSoul(l_nr)
End If
End Sub
I have a problem with a simple recursive function.
It works only for number <= 21.
When I debug I see the correct value getting returned but it seems that he also returns null for the first stacked function-call.
Maybe I'm overlooking something obvious ?
Sub CalculateSoul(p_datum)
For t = 0 To StrLength(p_datum)-1
l_nr = l_nr + SubString(p_datum,t,1)
Next
If l_nr <= 21 Then
Return l_nr
Else
CalculateSoul(l_nr)
End If
End Sub