In computer programming, an indent style is a convention governing the indentation of blocks of code to convey the program’s structure. This article largely addresses the free-form languages, such as C programming language and its descendants, but can be (and frequently is) applied to most other programming languages (especially those in the curly bracket family), where whitespace is otherwise insignificant. Indent style is just one aspect of programming style. Indentation is not a requirement of most programming languages, where it is used as secondary notation. Rather, programmers indent to better convey the structure of their programs to human readers. In particular, indentation is used to show the relationship between control flow constructs such as conditions or loops and code contained within and outside them. However, some programming languages (such as Python and occam) use the indentation to determine the structure instead of using braces or keywords; this is known as the off-side rule, and in these languages indentation is meaningful to the compiler, not just a matter of style. Note that this article uses “brackets” to refer to what are known as “parentheses” in American English, and “braces” to refer to what are known as “curly brackets” in American English.

Richard Goodwin

Richard Goodwin has been working as a tech journalist for over 10 years. He has written for Den of Geek, Fortean Times, IT PRO, PC Pro, ALPHR, and many other technology sites. He is the editor and owner of KnowYourMobile.

Leave a Reply

Your email address will not be published. Required fields are marked *