Subroutines - Functions
Revision as of 22:11, 15 December 2016 by QuantumFluctuator (talk | contribs)
A set of instructions designed to perform a frequently used operation within a program. This makes it easy to repeat code. A subroutine must be contained in a class, and should the class not be the same as the one calling it, it should be referred to directly or by instantiation.
Example
Every time greeting() is written the program runs the greeting subroutine.
Passing Variables
Variables may need to be passed across subroutines in order for them to execute correctly.
Example
Data Type Subroutines
A subroutine may need to return a variable type to assign to a variable when called. This can be done using any data type.