Block (programming): Difference between revisions

Content deleted Content added
No edit summary
m misc capitalization & "he or she" => "they"
Line 137:
</syntaxhighlight>
 
In the above [[Scheme (programming language)|Scheme]] fragment, empno is used to identify both the manager and his or hertheir underlings each by their respective ssn, but because the underling ssn is declared within an inner block it does not interact with the variable of the same name that contains the manager's ssn. In practice, considerations of clarity would probably lead the programmer to choose distinct variable names, but he or shethey hashave the choice and it is more difficult to introduce a bug inadvertently.
 
==Hoisting==
In some languages, a variable can be declared at function scope even within enclosed blocks. For example, in JavascriptJavaScript, variables declared with <code>var</code> have function scope.
 
==See also==