BB___SUB

=SUB= toc

Description
> Subs are independent blocks of code which the program calls to perform a specific task. The tasks are performed using the data which is passed to it by the program. In this way, the program can call upon the sub any number of times, (re-use the sub), changing only the data which it passes, and getting different results as may be needed.

> See also, CALL, FUNCTION and ByRef

Syntax

 * 1) sub subName //zero or more comma separated parameter variable names//
 * 2) end sub

Hints
> Sub names are case-sencitive, just like variables. > You cannot have subs with same names but different set of parameters. > You can have subs without parameters.

Passing of Variables
> Describe variable scoping and types in this section? > Maybe repeat on the FUNCTION page ...

Example
code format="vbnet" ' Here is a very simple example. ' print a salutation print "To: ";

' call the sub, passing the number 1 to it   call mySub 1

' return from the sub print print "Now is the time for ..." print

wait

' define the sub using a numeric variable to receive the ' numeric parameter which was passed to it

sub mySub num if num = 1 then print "All users:"   ' if number passed was a 1, print this line else print "Some users:"  ' if number passed is NOT a 1, print this line end if ' return to the program end sub

code

Useful Functions
code format="vbnet" Place a useful function using this command here code