Sub Statement

 

Sub SubName [(arguments)]

      Dim [variable(s)]

      [statementblock]

           [Exit Function]

 End Sub

 

Declares and defines a Sub procedures name, parameters and code.

 

When the optional argument list needs to be passed the format is as follows:

 

([ByVal] variable [As type] [,ByVal] variable [As type] ]…])

 

The optional ByVal parameter specifies that the variable is [passed by value instead of by reference (see “ByRef and  ByVal” in this manual).  The optional As type parameter is used to specify the data type.  Valid types are String, Integer, Double, Long, and Varaint (see “Variable Types” in this manual). 

 

Related Topics: Call, Dim, Function

 

Example:

 

Sub Main

   Dim DST As String

 

   DST = "t1"

   mkdir DST

   mkdir "t2"

End Sub