Subroutines and Functions
There are several good ways of developing modules, but the use of subroutines and functions is among the most common and the best. Both of these structures are named blocks of code that are, to some extent, separate and isolated from other code in the same program.
No matter what programming language you’re using, a subroutine tends to involve these elements:
Special statements mark the subroutine’s beginning and end.
The statement that marks the beginning also specifies the subroutine’s name and a list of arguments. Arguments are one of several ways that subroutines can receive input values and send back output values.
Between its opening and closing statements, a subroutine can contain both data declarations and executable ...
Get Faster Smarter Beginning Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.