Advertisements
Advertisements
Question
Define Local scope with an example.
Short Note
Solution
Local Scope:
Local scope refers to variables defined in the current function. Always, a function will the first lookup for a variable name in its local scope. Only if it does not find it there, the outer scopes are checked.
Look at this example
On execution of the above code, the variable a displays the value 7, because it is defined and available in the local scope.
shaalaa.com
Types of Variable Scope
Is there an error in this question or solution?