Block (programming): Difference between revisions

Content deleted Content added
No edit summary
Tags: Reverted Visual edit Mobile edit Mobile web edit Disambiguation links added
Undid revision 1276671753 by 177.236.4.45 (talk) useless link
Line 4:
{{refimprove|date=May 2010}}
 
In [[computer programming]], a '''block''' or '''code block''' or '''[[block]] of code''' is a lexical structure of [[source code]] which is grouped together. Blocks consist of one or more [[Declaration (computer programming)|declarations]] and [[Statement (computer science)|statements]]. A [[programming language]] that permits the creation of blocks, including blocks [[Nesting (computing)|nested]] within other blocks, is called a '''block-structured programming language'''. Blocks are fundamental to [[structured programming]], where [[control structure]]s are formed from blocks.
 
Blocks have two functions: to group statements so that they can be treated as one statement, and to define [[scope (computer science)|scopes]] for [[name binding|names]] to distinguish them from the same name used elsewhere. In a block-structured programming language, the objects named in outer blocks are visible inside inner blocks, unless they are [[Name masking|masked]] by an [[Object (computer science)|object]] declared with the same name.