What are parameters? What are arguments?

  • The variable that receives data and send to procedures, sub-procedures and function-procedures is called parameter.
    • Parameters are the predefined variables that indicate the input given to the sub-procedures.
  • Arguments are the actual values, that is passed to the sub-procedures or function-module at the time of calling it. Another name of arguments is actual parameter.

  • Syntax of Sub Procedure
CALL name (argument list)
SUB name (parameter list)
(statements)
END SUB

For an example: 
DECLARE SUB ADD (x, y)
CLS
    CALL add (5, 6)
END

SUB ADD (x, y)
    c=x+y
    PRINT c
END SUB

Explanation:
  • Here, variables x and y in the SUB add are the parameters of sub procedure add. The numbers 5 and 6 passed to add while invoking it from the main module are the arguments passed to the sub procedure add.
  • It should be noted that the parameters declared and arguments passed must match with each other regarding numbers and data type.
  • Arguments are passed to the sub-routines by putting numbers, strings. or related variables after SUB name, while invoking the SUB.
Parameters are two types: (View)
  • Actual or Real Parameters: 
  • Formal Parameters: 

Share :

Twitter

Random Posts

Back To Top

facebook main

counter

Powered by Blogger.