When assignment is made to these function variables which have been tagged as global , the global variable of the same name is modified. In either case, subsequent use of the variable within the function will actually operate on the global variable of the same name. The local scope variable specifies that a particular variable is local to the current statement block. Here x , y , and z are local to the function block. When the function is next called, the variable is recreated but with no trace of its former value.
All function parameters are local to the function body.
There are times when access is needed to variables which are defined in a wider scope but that are are still not global . Without the wider statement, the set function will not be able to modify the shared variable, i.e. value . The wider statement allows modification access to a variable defined in a wider scope. Without this statement, modification of a variable makes it local to the function by default. There are two ways local variables can survive beyond the end of the function call that created them.