This is always a hot topic at this time of year. It’s been a while since we did procedures, parameters, byVal, Byref & Data Flow
From Shawlands Acc
- Data flow within a program is handled by parameters
- A parameter is a value or a variable which is passed into or out from a subroutine
- The parameters used in a procedure call are ACTUAL parameters
- The parameters used in a procedure definition are called FORMAL parameters
- A parameter is passed BY REFERENCE if it is to by passed into and back out of a procedure
- A parameter is passed BY VALUE if it is to by passed into but NOT back out of a procedure
- Arrays are ALWAYS passed by reference
- The use of parameters means that variables can be kept local to subroutines
- This leads to programs being more reliable and robust
The link for last night homework session is:
I had a few questions about this in class today, so I think it’s worth going back over it.
Parameters are used by procedures and functions to pass information in and out. They are used in the definition and in the call of these constructs.
- The parameters used in the procedure/function definition are called the formal parameters.
- The parameters used in the procedure/function call are called the actual parameters.