What is sub procedure? with example.

  • A sub procedure is a small, logical and manageable and functional part of a program that performs specific tasks and does not return a value to the calling module.
  • A sub procedure is needed to be declared before it is used in a program. A CALL statement is used to call the sub procedure in a program. A sub program is written with SUB....END SUB statement. 
Syntax:
    SUB Name (parameters)
        statements
    END SUB
  • The first line shows the name of the procedure and parameters used in the procedure. When there is no parameters, the brackets after the name of the procedure are left empty.
For Example (Click)