Public Module Kata
Public Function Summation(ByVal n As Integer) As Integer
Dim number As Integer
number = 0
If(n > 0) Then
For m As Integer = 1 to n
number = number + m
Next
End If
Return number
End Function
End Module
Now, if I put 'Dim number As Integer' before the function why the result is 37 in the second test case?
OP solved it, closing
Please say which language you're using, there are several tens of them.
This is my solution
Now, if I put 'Dim number As Integer' before the function why the result is 37 in the second test case?