Re: Python: Global Variables?
in the context of programming..
a global variable is one that is accessible outside of a specific sub routing.
...sub function code...
in this example the variable called number is available to both the main function and the sub function. writting print number in either will show the contents of that variable.
int main ()
...more main code...
here the variables are declared inside the functions, and thus local to the functions. the variable called letter only appears inside the main function and you can't use it in the subfunction.
the variable called number appears in both the main and the subfunction. but crucially it's a local variable in each case, whilst it has the same name, underneath the program it has a different memory reference and has/can have different data stored within it.
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."