English
Tamil Nadu Board of Secondary EducationHSC Science Class 12

Define Local scope with an example. - Computer Science

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?
Chapter 3: Scoping - Evaluation [Page 29]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 12 TN Board
Chapter 3 Scoping
Evaluation | Q 1. | Page 29
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×