Please enable JavaScript.
Coggle requires JavaScript to display documents.
Procedures and Function (Benefits of using procedures (Repeating lines of…
Procedures and Function
-
-
They are activated by a call from the main program. When a procedure is called it produces an effect.
A local variable exists within one subroutine, fuction or procedure.
-
-
-
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.
-
Passing Parameters
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 in.
-
By Value
Passing a parameter by value is used when a parameter is needed in a subroutine but its value is not going to change in the subroutine.