Hi

I am new to programming and to VB.net. and am working through the book ASP.NET in 24 hrs. There is a very simple exercise to create a factorial function called from the Page_Load event. I have got as far as the following code which works, but the book suggests that it is the function that should contain a loop.

Could anyone suggest an alternative way of setting up the function.

Thanks

Sub Page_Load (sender as Object, e as EventArgs)
Dim I as Integer
For I = 1 to 5
Response.Write (Fac (I) & "<br>")
Next I
End Sub

Function Fac (number as Integer) as Integer
If number <= 1 Then
Return 1
Else
Return number * Fac (number - 1)
End If
End Function