Block (programming)

This is an old revision of this page, as edited by Lir (talk | contribs) at 17:01, 28 November 2003. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer programming, a statement block is a section of code which is grouped together; much like a paragraph. In C++, statement blocks are enclosed by brackets {}. Unlike paragraphs, statement blocks can be nested; that is, with one block inside another.

A C++ Statement Block

int main()
{
  return 0;
}

A Nested C++ Statement Block

#include <iostream>
int main()
{
int x=1;
if (x==1)
{
std::cout<<"text";
}
return 0;
}