Modular Programming
QBASIC supports modular programming. The modular programming is a programming technique in which the program is divided into small parts (logical, managable and functional parts).
The small logical, managable and functional parts parts of a program in modular programming are called modules. There are many modules in a modular program, each modular program contains one main module and sub module (procedure) in which thecinstruction codes or statements of a program are written. The statements or codes written in the main module are called Module Level Codes . The statements or codes written in procedure are called Procedure Level Codes. When you run a modular program, the program executes the first statement of main module.
The procedure has its specific name called Procedure name. The naming of procedure has the same rules as the naming of variables. In order to use the procedure in a program, you need to call it. When you call the procedure, the program control transfers to the procedure for its execution .
Sub Procedure
A sub procedure is a type of sub module or procedure in a modular programming. It does not return any value to the calling module in a modular program. A sub procedure is needed to be defined or called before it is used in a program. When a sub procedure is called, the program control transfers from the calling module to the called module . After the completion of task, the program control returns to the calling module.
Function Procedure
A function procedure is a sub module of a program that returns the value (string or number) to the calling module.
There are two types of function procedure string function procedure and numeric function procedure. A function is needed to be defined and call to use in a program. When a function procedure is called, the program control transfers to the called module from calling module. After completion of task, the program control transfers to the calling module with a value.