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
|