qb45advr.hlp (Topic list)
SUB...END SUB Statement Programming Examples
  QuickSCREEN      Details     Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
SUB...END SUB Statement Programming Examples
 
SUB_EX.BAS is a program file in the subdirectory ADVR_EX that illustrates
the SUB...END SUB statement. To look at the program in the View window and,
optionally, to run it, load the program using the File menu's Open Program
command.
 
The main program calls a subprogram which searches for a given string in
each line of input from a file. When the subprogram finds the string in a
line, it prints the line, along with the number of the line. Notice that
the value of a line number counter is saved between calls because the
STATIC keyword is used on the SUB statement.
 
Below is sample output from the program:
 
Pattern to search for? SUB
Line # 9 : SUB Linesearch(Test$,P$) STATIC
Line # 13 : END SUB