• Custom User Avatar

    OP solved it, closing

  • Custom User Avatar

    Please say which language you're using, there are several tens of them.

  • Custom User Avatar

    This is my solution

    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?