Published by: BhumiRaj Timalsina
Published date: 10 Jan 2022
The process of breaking a large program into small manageable tasks and designed them independently is called modular programming. A module program consists of a main module and one or more sub modules or procedures.This note provides an information about modular program in QBASIC.
The process of breaking a large program into small manageable tasks and designed them independently is called modular programming. A module program consists of a main module and one or more sub modules or procedures. Each sub module has a unique name. Modular Programming is a approach in which the program is divided into separate independent units is called modules.
There are two types of procedures in BASIC. They are as follows:
Sub Procedure : A sub procedure is a small manageable and functional part of a program that performs specific tasks and does not return any value to the calling module. A sub program is written with SUB....END SUB statements.
Function Procedure : A function procedure is small manageable and functional part of a program that performs the specific tasks and returns a single value to the main program or calling module. A function is written with FUNCTION....... END FUNCTION statement.
The constant or variables enclosed in the parentheses of procedure call statement and that are supplied to the procedure are known as arguments. The argument can be passed to a procedure either by reference or by value method.
Formal and Actual Parameter: Formal parameters are used to specify or declare the type of data to be passed to the procedures either by sub or function procedure.
Variables in sub procedure declaration which accept data or variables passed to them from the calling module are known as parameters. It is also known as formal parameter.
Local and Global variable : A variable which is defined in a module ans is not accessible to any other modules is known as local variable. A variable in main module which can be accessed from any module or procedure of a program is known as global variable.