Sub
Top  Previous  Next

Sub name (arglist)
statements
End Sub 

Declares the name, arguments, and code that form the body of a Sub procedure.

Parameters
 
name  
 
Name of the Sub. See standard variable naming conventions.  
 
arglist  
 
List of variables representing arguments that are passed to the Sub procedure when it is called. Multiple variables are separated by commas.  
 
statements  
 
Any group of statements to be executed within the body of the Sub procedure.  

Remarks


You can declare variable type within varlist or you can specify only variable name.  
You can't define a Sub procedure inside any other procedure.  
You call a Sub procedure using the procedure name followed by the argument list.  
Sub declaration must precede Sub call.  
Code execution starts with the first line after the last procedure.  

Example


Sub SomeSub (a as integer, b)  
          print "a = ", a  
          print "b = ", b  
End Sub  
 
........  
 
SomeSub(a + b + c, 123)  
 
........