Please enable JavaScript.
Coggle requires JavaScript to display documents.
Procedures and Functions (Procedure (Procedure code can be saved and re…
Procedures and Functions
-
-
Parameter
Formal
A formal parameter is used as a placeholder within a subprogram for the values received or sent to the main programs actual parameters
-
Variables, Reference and Value
By Reference
Passing a parameter by reference is used when a parameter is needed in a subroutine and its value is going to change in the subroutine when it is passed on
The subroutine will be passed the original parameter and any changes made in the subroutine will result in change to the original values held within the parameter
Global Variable
A global variable can be accessed and altered from any part of the program, even from another script/event so long as it is declared at the very start
Global variables should be used with care as their values may accidentally change if the programmer forgets that they have already used them in another subroutine
Scope of variables
-
-
For a global variable is visible throughout the whole program. This means the scope is the whole program
-
Local Variable
A local variable exists within one subroutine, function, or procedure
A local variable is created when the subroutine is called and are then destroyed when the subroutine terminates
-
-
-