|
-
Aug 18th, 2005, 03:09 AM
#1
Thread Starter
New Member
Help for a newbie please
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|