Block

Why Trust Techopedia

What Does Block Mean?

A block is a section of software code or an algorithm in
software programming. A block can consist of one or more statements or declarations. It is possible for a block to contain one or more blocks nested within it. If a programming language comprises blocks and nested blocks, it is called a block-structured programming language. Blocks are a basic feature of structured programming and help form control structures. However, it is not necessary to add blocks in software code; blocks should be driven by necessity. At the same time, blocks can improve code efficiency.

Advertisements

A block is also known as a code block.

Techopedia Explains Block

The main utility of blocks is to allow the entire section of code
containing the block to be treated as a single piece of code, and that offers a number of advantages. The biggest advantage is that it helps avoid confusion if the same variables are defined in a different place in the same code. Since the variables are defined within a code block but it is not treated independently, but rather as a single piece of code, there is no confusion over the presence of variables in other places. In other words, blocks help reduce the lexical scope of the variables, functions and procedures stored in other places.

Blocks use different syntax in different places. Code blocks can be of two types broadly: the ALGOL family and the C family.

Advertisements

Related Terms

Margaret Rouse
Editor

Margaret jest nagradzaną technical writerką, nauczycielką i wykładowczynią. Jest znana z tego, że potrafi w prostych słowach pzybliżyć złożone pojęcia techniczne słuchaczom ze świata biznesu. Od dwudziestu lat jej definicje pojęć z dziedziny IT są publikowane przez Que w encyklopedii terminów technologicznych, a także cytowane w artykułach ukazujących się w New York Times, w magazynie Time, USA Today, ZDNet, a także w magazynach PC i Discovery. Margaret dołączyła do zespołu Techopedii w roku 2011. Margaret lubi pomagać znaleźć wspólny język specjalistom ze świata biznesu i IT. W swojej pracy, jak sama mówi, buduje mosty między tymi dwiema domenami, w ten…