Next | Program Repair Shop | 38 |
Functions should avoid using global variables
Why do we have functions?
For modularity
Benefit 1: Understand the function in isolation
Benefit 2: Reuse the function in another program
Using global variables in functions defeats both of these
Use functional parameter-passing mechanisms wherever possible
Global Variables are red flags
Next | Copyright © 2002 M. J. Dominus |