• The sample VB.net code for comparison contains both syntax and logic errors.

    In VB.Net, an IF is ended by "End If", not End.

    Also, "If result = number * Factorial(number - 1)" is attempted assignment and comparison and produces an incorrect result. If you run this code, you always get zero as a result.

    Refactored code:

    Private Function Factorial(ByVal number As Integer) As Integer

      If number = 0 Then

        Return 1

      Else

        Return (number * Factorial(number - 1))

      End If

    End Function