Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


Visual Basic Programming Code Examples

Visual Basic > Code Snippets Code Examples

Factorial function

Factorial function Public Function Factorial(ByVal Factor As Byte) As Variant On Error GoTo ErrorHandler If Factor = 0 Then Factorial = 1 Else Factorial = Factor * Factorial(Factor - 1) End If Exit Function ErrorHandler: MsgBox Err.Description End Function Private Sub Form_Load() MsgBox Factorial(3) End Sub