Quickie, global variables and sub functions.
1 visualizzazione (ultimi 30 giorni)
I have a primary function set with 12 global variables I want the sub-functions to use, they are only double constants held during a loop.
Apart from being typing lazy (copy/past) and prob bad programming, is there any programming problem or reason why I should not declare a global variable in a sub-function that is not used?
Paulo Silva il 6 Dic 2011
The variables should be passed to the functions as arguments, using global variables always introduce problems that are hard to debug, also if you declare a variable on a function you can access the same variable in every sub-function of that function.
Now for your question, besides the use of global variables and that sub-function that's not used?! I don't see any other problem