Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











STATEMENT:  Sub

Sub
 
The Sub statement creates a subroutine, assigns a name, and allows you to list arguments which are to be passed into the subroutine.
 
The major difference between a subroutine and a function, is that a subroutine cannot return any value back to where it was called from.
 
As an option, subroutines can be declared Private or Public. You can call other subroutines and functions from within a subroutine (nesting). You must end every subroutine with End Sub or you will get an error message. One option for leaving a subroutine is to use Exit statements.
 
Code:
<% Sub aardvark %>
   <% Rem you can place all of the code you desire inside a subroutine %>
<% End Sub %>

 
Code:
<% Private Sub aardvark %>
   <% Rem you can place all of the code you desire inside a subroutine %>
<% End Sub %>

 
You can list more than one argument in the subroutine.
 
Code:
<%
Sub aardvark(myvar1, myvar2, mynumber, myarray)
   Rem you can place all of the code you desire inside a subroutine
End Sub
%>


 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information