Indentation Guide, Meaning , Facts, Information and Description
An indentation can mean two things:
- To make notches in something or form deep recesses in a coastline for instance.
- To place text farther to the left to separate it from surrounding text.
and this is an indentation of two spaces:Indented block
Indented block 2
In the written form of many American and European languages, an indentation is used at the beginning of a line to signal the start of a new paragraph.
In computer programming languages, indentation is used to format source code in order to improve its readability. Indentation is generally only of use to programmers; compilers and interpreters rarely care how much whitespace is present inbetween programming statements. (Python is a notable exception to this rule.) Debates over where to indent, whether to use spaces or tabs, and how many spaces to use are often hotly debated among programmers, leading some to classify indentation as a religious war.
(The following is from The Jargon File, version 4.4.7)
There are four major indentation styles (which determine the number of spaces to indent and where to indent) for the C programming language, which is also used for other programming languages with syntaxes similar to that of C, notably Java and C++:
Surveys have shown the Allman and Whitesmiths styles to be the most common, with about equal mind shares. K&R/1TBS used to be nearly universal, but is now much less common in C (the opening brace tends to get lost against the right paren of the guard part in an if or while, which is, in the words of the Jargon File, "a Bad Thing." Defenders of 1TBS argue that any putative gain in readability is less important than their style's relative economy with vertical space, which enables one to see more code on one's screen at once. The Java Language Specification legislates not only the capitalization of identifiers, but where nouns, adjectives, and verbs should be in method, class, interface, and variable names (section 6.8). While the specification stops short of also standardizing on a bracing style, all source code originating from Sun Laboratories uses the K&R style. This has set a precedent for Java programmers, which most follow.
Indentation in programming
(
}
if (
}
if (
{
}
if (
{
}
