Home  |  Latest News  |  Contribute  |  F.A.Q.  |  Account  |  Scripts | About
Search ASPNut:
 
ASP Reference
Server Variables
ASP Glossary
Related Sites

Free Components

HTML Reference
Web Colors
Entities
CSS Level 1
Encode/Decode
Glossary

Our Sponsors
ASP Nuke CMS
Free Auctions
PHP 5 Script
Funktastic Blog
ULost Directory
Team Task

 

 

 

 

 

 

 

 

 

 

 

 

Sub

The Sub statement declares a subroutine. A subroutine is just like a function except that a subroutine does not return any value.

You can use the Exit Sub statement to terminate the execution of a subroutine before the normal end is encoutered.

' call the subroutine here TimeOfDay

Sub TimeOfDay
    If Hour(Now()) < 12 Then
        Response.Write "Good Morning!"
    ElseIf Hour(Now()) < 16 Then
        Response.Write "Good Afternoon!"
    Else
        Response.Write "Good Evening!"
    End If
End Sub


You may also create a subroutine that calls itself recursively as shown in the example below.

' demonstrates a subroutine that calls itself recursively Sub CountDown(nStart)
    Response.Write "Count = " & nStart & "<BR>"
    If nStart > 1 Then CountDown nStart - 1
End Sub

Orvado Technologies

ASP Nuke CMS
Free Open Source
Content Manager
HomeFix Boards
Home Remodeling
Message Boards

Contact Us | Contribute | About | Site Map



"You have not converted a man because you have silenced him." - John Morley

©2007 Orvado Technologies, All Rights Reserved
ASP Nut provides articles and reference documentation for Active Server Page developers.