Computer Science Canada global vs local variables |
Author: | person [ Fri Oct 07, 2005 7:10 pm ] |
Post subject: | global vs local variables |
y have both global and local variables?? y not make them all global? |
Author: | wtd [ Fri Oct 07, 2005 7:17 pm ] |
Post subject: | |
Aside from the many other reasons to use locals: When you localize variables inside a function, you remove the need to peruse the entire source code to look for influences. When you use local variables and parameters/arguments properly, pretty much everything you need to know is within the function definition. |