Block (programming): Difference between revisions

Content deleted Content added
top: by writing a synonym
Tags: Mobile edit Mobile app edit Android app edit
clarify that there are two pretty much orthogonal functions of blocks
Line 5:
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 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.
 
TheBlocks functionhave oftwo blocksfunctions: into programminggroup isstatements toso enablethat groupsthey of statements tocan be treated as if they were one statement,; and to narrow thedefine [[lexicalscope (computer scopescience)|scopes]] offor objects[[name suchbinding|names]] as variables, procedures and functions declared in a block so that they do not conflictto withdistinguish thosethem havingfrom 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 declared with the same name.
 
==History==