Indentation
   HOME

TheInfoList



OR:

__FORCETOC__ In the written form of many
language Language is a structured system of communication. The structure of a language is its grammar and the free components are its vocabulary. Languages are the primary means by which humans communicate, and may be conveyed through a variety of ...
s, an indentation or indent is an empty space at the beginning of a line to signal the start of a new
paragraph A paragraph () is a self-contained unit of discourse in writing dealing with a particular point or idea. Though not required by the orthographic conventions of any language with a writing system, paragraphs are a conventional means of organizing e ...
. Many computer languages have adopted this technique to designate "paragraphs" or other logical blocks in the program. For example, the following lines are indented, using between one and six spaces:  This paragraph is indented by 1 space.    This paragraph is indented by 3 spaces.       This paragraph is indented by 6 spaces. In computer programming, the
neologism A neologism Ancient_Greek.html"_;"title="_from_Ancient_Greek">Greek_νέο-_''néo''(="new")_and_λόγος_/''lógos''_meaning_"speech,_utterance"is_a_relatively_recent_or_isolated_term,_word,_or_phrase_that_may_be_in_the_process_of_entering_com ...
s outdent, unindent and dedent are used to describe the reversal of the indentation process, realigning text with the page margin (or with previous, lesser, levels of indentation). In
right-to-left In a script (commonly shortened to right to left or abbreviated RTL, RL-TB or R2L), writing starts from the right of the page and continues to the left, proceeding from top to bottom for new lines. Arabic, Hebrew, Persian, Pashto, Urdu, Kashmir ...
languages (e.g.
Hebrew Hebrew (; ; ) is a Northwest Semitic language of the Afroasiatic language family. Historically, it is one of the spoken languages of the Israelites and their longest-surviving descendants, the Jews and Samaritans. It was largely preserved ...
and
Arabic Arabic (, ' ; , ' or ) is a Semitic language spoken primarily across the Arab world.Semitic languages: an international handbook / edited by Stefan Weninger; in collaboration with Geoffrey Khan, Michael P. Streck, Janet C. E.Watson; Walter ...
), indentation is used just the same, but from the right margin of the paper, where the line begins.


Indentation in typesetting

There are three main types of indentation, illustrated below in relation to borders representing the page dimensions.


Indentation in programming

In computer
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
s, indentation is used to format program
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the ...
to improve readability. Indentation is generally only of use to programmers;
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
s and
interpreters Interpreting is a translational activity in which one produces a first and final target-language output on the basis of a one-time exposure to an expression in a source language. The most common two modes of interpreting are simultaneous interp ...
rarely care how much whitespace is present in between programming statements. However, certain programming languages rely on the use of indentation to demarcate programming structure, often using a variation of the off-side rule. The
Haskell Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lan ...
, Occam, Python, MoonScript, and Ya programming languages rely on indentation in this way. Opinions about where to indent, whether to use spaces or tabs, and how many spaces to use are often hotly debated among programmers, leading some to describe indentation disputes as akin to a
religious war A religious war or a war of religion, sometimes also known as a holy war ( la, sanctum bellum), is a war which is primarily caused or justified by differences in religion. In the modern period, there are frequent debates over the extent to ...
. In 2006 a third method of indentation was proposed, called elastic tabstops. In addition to general indentation of statements, different bracket indentation styles are commonly used.


References

{{Commons cat, Indentation (typesetting) Typography Source code