I have the following simple code to compute the sum of values until the indicated number. The total is stored inside result.
def ComputeMath(number, result):
if number > 0:
result = number + result
print('if', result)
ComputeMath(number-1, result)
else:
print("else", result)
return result;
output = ComputeMath(5,0)
print(output)
For some reason output is always None. Printing it inside the function works fine. I just cannot figure out why this is happenning. Here is the output:
