CINXE.COM
Indentation style - Wikipedia
<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-sticky-header-enabled vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Indentation style - Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-sticky-header-enabled vector-toc-available";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"faa938e0-60fa-4ce0-a85a-75e2605aff07","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Indentation_style","wgTitle":"Indentation style","wgCurRevisionId":1282552939,"wgRevisionId":1282552939,"wgArticleId":294545,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["CS1 interwiki-linked names","Articles with short description","Short description matches Wikidata","Use dmy dates from October 2022","All articles with unsourced statements","Articles with unsourced statements from October 2016","Articles with unsourced statements from February 2013","Articles needing additional references from March 2024","All articles needing additional references","Software wars","Text editor features","Source code"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Indentation_style","wgRelevantArticleId":294545,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":false,"wgFlaggedRevsParams":{"tags":{"status":{"levels":1}}},"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":50000,"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q13444128","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGELevelingUpEnabledForUser":false}; RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","ext.pygments":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready"};RLPAGEMODULES=["ext.cite.ux-enhancements","ext.pygments.view","site","mediawiki.page.ready","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.ReferenceTooltips","ext.gadget.switcher","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns","ext.cx.uls.quick.actions","wikibase.client.vector-2022","ext.checkUser.clientHints","ext.quicksurveys.init","ext.growthExperiments.SuggestedEditSession"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&modules=ext.cite.styles%7Cext.pygments%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022"> <script async="" src="/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&modules=site.styles&only=styles&skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.22"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="Indentation style - Wikipedia"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//en.m.wikipedia.org/wiki/Indentation_style"> <link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=Indentation_style&action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (en)"> <link rel="EditURI" type="application/rsd+xml" href="//en.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://en.wikipedia.org/wiki/Indentation_style"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php?title=Special:RecentChanges&feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Indentation_style rootpage-Indentation_style skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" title="Main menu" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Main_Page" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-contents" class="mw-list-item"><a href="/wiki/Wikipedia:Contents" title="Guides to browsing Wikipedia"><span>Contents</span></a></li><li id="n-currentevents" class="mw-list-item"><a href="/wiki/Portal:Current_events" title="Articles related to current events"><span>Current events</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Visit a randomly selected article [x]" accesskey="x"><span>Random article</span></a></li><li id="n-aboutsite" class="mw-list-item"><a href="/wiki/Wikipedia:About" title="Learn about Wikipedia and how it works"><span>About Wikipedia</span></a></li><li id="n-contactpage" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us" title="How to contact Wikipedia"><span>Contact us</span></a></li> </ul> </div> </div> <div id="p-interaction" class="vector-menu mw-portlet mw-portlet-interaction" > <div class="vector-menu-heading"> Contribute </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Help:Contents" title="Guidance on how to use and edit Wikipedia"><span>Help</span></a></li><li id="n-introduction" class="mw-list-item"><a href="/wiki/Help:Introduction" title="Learn how to edit Wikipedia"><span>Learn to edit</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Community_portal" title="The hub for editors"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes to Wikipedia [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_upload_wizard" title="Add images or other media for use on Wikipedia"><span>Upload file</span></a></li><li id="n-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages"><span>Special pages</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Main_Page" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="Wikipedia" src="/static/images/mobile/copyright/wikipedia-wordmark-en.svg" style="width: 7.5em; height: 1.125em;"> <img class="mw-logo-tagline" alt="The Free Encyclopedia" src="/static/images/mobile/copyright/wikipedia-tagline-en.svg" width="117" height="13" style="width: 7.3125em; height: 0.8125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search Wikipedia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia" aria-label="Search Wikipedia" autocapitalize="sentences" title="Search Wikipedia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page's font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&returnto=Indentation+style" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&returnto=Indentation+style" title="You're encouraged to log in; however, it's not mandatory. [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="Log in and more options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/?wmf_source=donate&wmf_medium=sidebar&wmf_campaign=en.wikipedia.org&uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&returnto=Indentation+style" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&returnto=Indentation+style" title="You're encouraged to log in; however, it's not mandatory. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">(Top)</div> </a> </li> <li id="toc-Overview" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Overview"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Overview</span> </div> </a> <ul id="toc-Overview-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Research" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Research"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Research</span> </div> </a> <ul id="toc-Research-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Notable_styles" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Notable_styles"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Notable styles</span> </div> </a> <ul id="toc-Notable_styles-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-C/C++_styles" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#C/C++_styles"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>C/C++ styles</span> </div> </a> <button aria-controls="toc-C/C++_styles-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle C/C++ styles subsection</span> </button> <ul id="toc-C/C++_styles-sublist" class="vector-toc-list"> <li id="toc-K&R" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#K&R"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.1</span> <span>K&R</span> </div> </a> <ul id="toc-K&R-sublist" class="vector-toc-list"> <li id="toc-Egyptian_braces" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Egyptian_braces"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.1.1</span> <span>Egyptian braces</span> </div> </a> <ul id="toc-Egyptian_braces-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Single_statements" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Single_statements"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.1.2</span> <span>Single statements</span> </div> </a> <ul id="toc-Single_statements-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-One_True_Brace" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#One_True_Brace"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.2</span> <span>One True Brace</span> </div> </a> <ul id="toc-One_True_Brace-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Linux_kernel" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Linux_kernel"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.3</span> <span>Linux kernel</span> </div> </a> <ul id="toc-Linux_kernel-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Java" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Java"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.4</span> <span>Java</span> </div> </a> <ul id="toc-Java-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Stroustrup" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Stroustrup"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.5</span> <span>Stroustrup</span> </div> </a> <ul id="toc-Stroustrup-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-BSD_KNF" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#BSD_KNF"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.6</span> <span>BSD KNF</span> </div> </a> <ul id="toc-BSD_KNF-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Allman" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Allman"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.7</span> <span>Allman</span> </div> </a> <ul id="toc-Allman-sublist" class="vector-toc-list"> <li id="toc-Variant:_Allman-8" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Variant:_Allman-8"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.7.1</span> <span>Variant: Allman-8</span> </div> </a> <ul id="toc-Variant:_Allman-8-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Whitesmiths" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Whitesmiths"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.8</span> <span>Whitesmiths</span> </div> </a> <ul id="toc-Whitesmiths-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-GNU" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#GNU"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.9</span> <span>GNU</span> </div> </a> <ul id="toc-GNU-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Horstmann" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Horstmann"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.10</span> <span>Horstmann</span> </div> </a> <ul id="toc-Horstmann-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Pico" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Pico"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.11</span> <span>Pico</span> </div> </a> <ul id="toc-Pico-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Ratliff" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Ratliff"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.12</span> <span>Ratliff</span> </div> </a> <ul id="toc-Ratliff-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-C_derived_language_styles" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#C_derived_language_styles"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>C derived language styles</span> </div> </a> <button aria-controls="toc-C_derived_language_styles-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle C derived language styles subsection</span> </button> <ul id="toc-C_derived_language_styles-sublist" class="vector-toc-list"> <li id="toc-Lisp_style" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Lisp_style"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.1</span> <span>Lisp style</span> </div> </a> <ul id="toc-Lisp_style-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Haskell_style" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Haskell_style"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.2</span> <span>Haskell style</span> </div> </a> <ul id="toc-Haskell_style-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-APL_style" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#APL_style"> <div class="vector-toc-text"> <span class="vector-toc-numb">5.3</span> <span>APL style</span> </div> </a> <ul id="toc-APL_style-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Indentation_size" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Indentation_size"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>Indentation size</span> </div> </a> <button aria-controls="toc-Indentation_size-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Indentation size subsection</span> </button> <ul id="toc-Indentation_size-sublist" class="vector-toc-list"> <li id="toc-Tab_vs._space" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Tab_vs._space"> <div class="vector-toc-text"> <span class="vector-toc-numb">6.1</span> <span>Tab vs. space</span> </div> </a> <ul id="toc-Tab_vs._space-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Style_automation" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Style_automation"> <div class="vector-toc-text"> <span class="vector-toc-numb">7</span> <span>Style automation</span> </div> </a> <ul id="toc-Style_automation-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Losing_track_of_blocks" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Losing_track_of_blocks"> <div class="vector-toc-text"> <span class="vector-toc-numb">8</span> <span>Losing track of blocks</span> </div> </a> <ul id="toc-Losing_track_of_blocks-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">9</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-References" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#References"> <div class="vector-toc-text"> <span class="vector-toc-numb">10</span> <span>References</span> </div> </a> <ul id="toc-References-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-External_links" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#External_links"> <div class="vector-toc-text"> <span class="vector-toc-numb">11</span> <span>External links</span> </div> </a> <button aria-controls="toc-External_links-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle External links subsection</span> </button> <ul id="toc-External_links-sublist" class="vector-toc-list"> <li id="toc-Tabs_and_spaces" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Tabs_and_spaces"> <div class="vector-toc-text"> <span class="vector-toc-numb">11.1</span> <span>Tabs and spaces</span> </div> </a> <ul id="toc-Tabs_and_spaces-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" title="Table of Contents" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Indentation style</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="Go to an article in another language. Available in 16 languages" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-16" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">16 languages</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-ar mw-list-item"><a href="https://ar.wikipedia.org/wiki/%D8%A3%D8%B3%D9%84%D9%88%D8%A8_%D8%A5%D8%B2%D8%A7%D8%AD%D8%A9" title="أسلوب إزاحة – Arabic" lang="ar" hreflang="ar" data-title="أسلوب إزاحة" data-language-autonym="العربية" data-language-local-name="Arabic" class="interlanguage-link-target"><span>العربية</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Einr%C3%BCckungsstil" title="Einrückungsstil – German" lang="de" hreflang="de" data-title="Einrückungsstil" data-language-autonym="Deutsch" data-language-local-name="German" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-es mw-list-item"><a href="https://es.wikipedia.org/wiki/Estilo_de_sangrado" title="Estilo de sangrado – Spanish" lang="es" hreflang="es" data-title="Estilo de sangrado" data-language-autonym="Español" data-language-local-name="Spanish" class="interlanguage-link-target"><span>Español</span></a></li><li class="interlanguage-link interwiki-fa mw-list-item"><a href="https://fa.wikipedia.org/wiki/%D8%B3%D8%A8%DA%A9_%D8%AA%D9%88%D8%B1%D9%81%D8%AA%DA%AF%DB%8C" title="سبک تورفتگی – Persian" lang="fa" hreflang="fa" data-title="سبک تورفتگی" data-language-autonym="فارسی" data-language-local-name="Persian" class="interlanguage-link-target"><span>فارسی</span></a></li><li class="interlanguage-link interwiki-fr mw-list-item"><a href="https://fr.wikipedia.org/wiki/Style_d%27indentation" title="Style d'indentation – French" lang="fr" hreflang="fr" data-title="Style d'indentation" data-language-autonym="Français" data-language-local-name="French" class="interlanguage-link-target"><span>Français</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%EB%93%A4%EC%97%AC%EC%93%B0%EA%B8%B0_%EB%B0%A9%EC%8B%9D" title="들여쓰기 방식 – Korean" lang="ko" hreflang="ko" data-title="들여쓰기 방식" data-language-autonym="한국어" data-language-local-name="Korean" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-it mw-list-item"><a href="https://it.wikipedia.org/wiki/Stile_d%27indentazione" title="Stile d'indentazione – Italian" lang="it" hreflang="it" data-title="Stile d'indentazione" data-language-autonym="Italiano" data-language-local-name="Italian" class="interlanguage-link-target"><span>Italiano</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/%E5%AD%97%E4%B8%8B%E3%81%92%E3%82%B9%E3%82%BF%E3%82%A4%E3%83%AB" title="字下げスタイル – Japanese" lang="ja" hreflang="ja" data-title="字下げスタイル" data-language-autonym="日本語" data-language-local-name="Japanese" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-no mw-list-item"><a href="https://no.wikipedia.org/wiki/Innrykkstil" title="Innrykkstil – Norwegian Bokmål" lang="nb" hreflang="nb" data-title="Innrykkstil" data-language-autonym="Norsk bokmål" data-language-local-name="Norwegian Bokmål" class="interlanguage-link-target"><span>Norsk bokmål</span></a></li><li class="interlanguage-link interwiki-pt mw-list-item"><a href="https://pt.wikipedia.org/wiki/Indenta%C3%A7%C3%A3o" title="Indentação – Portuguese" lang="pt" hreflang="pt" data-title="Indentação" data-language-autonym="Português" data-language-local-name="Portuguese" class="interlanguage-link-target"><span>Português</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/%D0%9E%D1%82%D1%81%D1%82%D1%83%D0%BF_(%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5)" title="Отступ (программирование) – Russian" lang="ru" hreflang="ru" data-title="Отступ (программирование)" data-language-autonym="Русский" data-language-local-name="Russian" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-ta mw-list-item"><a href="https://ta.wikipedia.org/wiki/%E0%AE%89%E0%AE%B3%E0%AF%8D%E0%AE%A4%E0%AE%B3%E0%AF%8D_%E0%AE%AA%E0%AE%BE%E0%AE%A3%E0%AE%BF" title="உள்தள் பாணி – Tamil" lang="ta" hreflang="ta" data-title="உள்தள் பாணி" data-language-autonym="தமிழ்" data-language-local-name="Tamil" class="interlanguage-link-target"><span>தமிழ்</span></a></li><li class="interlanguage-link interwiki-uk mw-list-item"><a href="https://uk.wikipedia.org/wiki/%D0%92%D1%96%D0%B4%D1%81%D1%82%D1%83%D0%BF_(%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D1%83%D0%B2%D0%B0%D0%BD%D0%BD%D1%8F)" title="Відступ (програмування) – Ukrainian" lang="uk" hreflang="uk" data-title="Відступ (програмування)" data-language-autonym="Українська" data-language-local-name="Ukrainian" class="interlanguage-link-target"><span>Українська</span></a></li><li class="interlanguage-link interwiki-ur mw-list-item"><a href="https://ur.wikipedia.org/wiki/%D8%A7%D9%86%DA%88%DB%8C%D9%86%D9%B9_%D8%A7%D8%B3%D9%B9%D8%A7%D8%A6%D9%84" title="انڈینٹ اسٹائل – Urdu" lang="ur" hreflang="ur" data-title="انڈینٹ اسٹائل" data-language-autonym="اردو" data-language-local-name="Urdu" class="interlanguage-link-target"><span>اردو</span></a></li><li class="interlanguage-link interwiki-zh-yue mw-list-item"><a href="https://zh-yue.wikipedia.org/wiki/%E7%B8%AE%E6%8E%92%E9%A2%A8%E6%A0%BC" title="縮排風格 – Cantonese" lang="yue" hreflang="yue" data-title="縮排風格" data-language-autonym="粵語" data-language-local-name="Cantonese" class="interlanguage-link-target"><span>粵語</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/%E7%BC%A9%E8%BF%9B%E9%A3%8E%E6%A0%BC" title="缩进风格 – Chinese" lang="zh" hreflang="zh" data-title="缩进风格" data-language-autonym="中文" data-language-local-name="Chinese" class="interlanguage-link-target"><span>中文</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q13444128#sitelinks-wikipedia" title="Edit interlanguage links" class="wbc-editpage">Edit links</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Indentation_style" title="View the content page [c]" accesskey="c"><span>Article</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Indentation_style" rel="discussion" title="Discuss improvements to the content page [t]" accesskey="t"><span>Talk</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Indentation_style"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Indentation_style&action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Indentation_style&action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Indentation_style"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Indentation_style&action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Indentation_style&action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Indentation_style" title="List of all English Wikipedia pages containing links to this page [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Indentation_style" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Indentation_style&oldid=1282552939" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Indentation_style&action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&page=Indentation_style&id=1282552939&wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FIndentation_style"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FIndentation_style"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&page=Indentation_style&action=show-download-screen" title="Download this page as a PDF file"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Indentation_style&printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q13444128" title="Structured data on this page hosted by Wikidata [g]" accesskey="g"><span>Wikidata item</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> </div> <div id="siteSub" class="noprint">From Wikipedia, the free encyclopedia</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">Computer programming convention</div> <style data-mw-deduplicate="TemplateStyles:r1236090951">.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}</style><div role="note" class="hatnote navigation-not-searchable">For broader coverage of this topic, see <a href="/wiki/Indentation_(typesetting)" title="Indentation (typesetting)">Indentation (typesetting)</a>.</div> <p class="mw-empty-elt"> </p><p>In <a href="/wiki/Computer_programming" title="Computer programming">computer programming</a>, <b>indentation style</b> is a <a href="/wiki/Convention_(norm)" title="Convention (norm)">convention</a> or <a href="/wiki/Programming_style" title="Programming style">style</a>, governing the <a href="/wiki/Indentation_(typesetting)" title="Indentation (typesetting)">indentation</a> of lines of <a href="/wiki/Source_code" title="Source code">source code</a>. An indentation style generally specifies a consistent number of <a href="/wiki/Whitespace_character" title="Whitespace character">whitespace characters</a> before each line of a block, so that the lines of code appear to be related, and dictates whether to use <a href="/wiki/Space_(punctuation)" title="Space (punctuation)">spaces</a> or <a href="/wiki/Tab_character" class="mw-redirect" title="Tab character">tabs</a> as the indentation character. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Overview">Overview</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=1" title="Edit section: Overview"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>This article primarily addresses styles for <a href="/wiki/Free-form_language" title="Free-form language">free-form</a> <a href="/wiki/Programming_language" title="Programming language">programming languages</a>. As the name implies, such language code need not follow an indentation style. Indentation is a <a href="/wiki/Secondary_notation" title="Secondary notation">secondary notation</a> that is often intended to lower <a href="/wiki/Cognitive_load" title="Cognitive load">cognitive load</a> for a programmer to understand the structure of the code. Indentation can clarify the separation between the code executed based on <a href="/wiki/Control_flow" title="Control flow">control flow</a>. </p><p>Structured languages, such as <a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a> and <a href="/wiki/Occam_(programming_language)" title="Occam (programming language)">occam</a>, use indentation to determine the structure instead of using braces or keywords; this is termed the <a href="/wiki/Off-side_rule" title="Off-side rule">off-side rule</a>. In such languages, indentation is meaningful to the language processor (such as <a href="/wiki/Compiler" title="Compiler">compiler</a> or <a href="/wiki/Interpreter_(computing)" title="Interpreter (computing)">interpreter</a>). A programmer must conform to the language's indentation rules although may be free to choose indentation size. </p><p>This article focuses on <a href="/wiki/Curly-bracket_languages" class="mw-redirect" title="Curly-bracket languages">curly-bracket languages</a> (that delimit blocks with <a href="/wiki/Curly_bracket" class="mw-redirect" title="Curly bracket">curly brackets, a.k.a. curly braces, a.k.a. braces</a>) and in particular <a href="/wiki/List_of_C-family_programming_languages" title="List of C-family programming languages">C-family languages</a>, but a convention used for one language can be adapted to another language. For example, a language that uses <code>BEGIN</code> and <code>END</code> keywords instead of braces can be adapted by treating <code>BEGIN</code> the same as the open brace and so on. </p><p>Indentation style only applies to text-based languages. <a href="/wiki/Visual_programming_language" title="Visual programming language">Visual programming languages</a> have no indentation. </p> <div class="mw-heading mw-heading2"><h2 id="Research">Research</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=2" title="Edit section: Research"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Despite the ubiquitous use of indentation styles, little research has been conducted on its value. First experiments, conducted by Weissman in 1974, did not show any effect.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> In 2023, an experiment by Morzeck et al.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> showed a significant positive effect for nested <code>if</code> statements where non-indented code required on average 179% more time to read than indented code. A follow up-experiment by Hanenberg et al.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> confirmed a large effect (although in that experiment non-indented code just took 113% more time to read) and revealed that the differences in reading times can be explained by the code that can be skipped (for indented code). In another experiment on JSON objects<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> non-indented code took even 544% more time to read. </p> <div class="mw-heading mw-heading2"><h2 id="Notable_styles">Notable styles</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=3" title="Edit section: Notable styles"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The table below includes code examples of various indentation styles. For consistency, indentation size for example code is 4 spaces even though this varies by coding convention. </p> <table class="wikitable"> <tbody><tr> <th>Example</th> <th>Name </th></tr> <tr> <td style="padding: 0 4px"><div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span> <span class="p">{</span> <span class="w"> </span><span class="n">foo</span><span class="p">();</span> <span class="w"> </span><span class="n">bar</span><span class="p">();</span> <span class="p">}</span> </pre></div> </td> <td><a href="#Allman_style">Allman</a> </td></tr> <tr> <td style="padding: 0 4px"><div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span> <span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">foo</span><span class="p">();</span> <span class="w"> </span><span class="n">bar</span><span class="p">();</span> <span class="w"> </span><span class="p">}</span> </pre></div> </td> <td><a href="#GNU">GNU</a> </td></tr> <tr> <td style="padding: 0 4px"><div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span> <span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">foo</span><span class="p">();</span> <span class="w"> </span><span class="n">bar</span><span class="p">();</span> <span class="w"> </span><span class="p">}</span> </pre></div> </td> <td><a href="#Whitesmiths">Whitesmiths</a> </td></tr> <tr> <td style="padding: 0 4px"><div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">foo</span><span class="p">();</span> <span class="w"> </span><span class="n">bar</span><span class="p">();</span> <span class="p">}</span> </pre></div> </td> <td><a href="#K&R">K&R</a> </td></tr> <tr> <td style="padding: 0 4px"><div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">foo</span><span class="p">();</span> <span class="w"> </span><span class="n">bar</span><span class="p">();</span> <span class="w"> </span><span class="p">}</span> </pre></div> </td> <td><a href="#Ratliff">Ratliff</a> </td></tr> <tr> <td style="padding: 0 4px"><div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span> <span class="p">{</span><span class="w"> </span><span class="n">foo</span><span class="p">();</span> <span class="w"> </span><span class="n">bar</span><span class="p">();</span> <span class="p">}</span> </pre></div> </td> <td><a href="#Horstmann">Horstmann</a> </td></tr> <tr> <td style="padding: 0 4px"><div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span> <span class="p">{</span><span class="w"> </span><span class="n">foo</span><span class="p">();</span> <span class="w"> </span><span class="n">bar</span><span class="p">();</span><span class="w"> </span><span class="p">}</span> </pre></div> </td> <td><a href="#Pico">Pico</a> </td></tr> <tr> <td style="padding: 0 4px"><div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span> <span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">foo</span><span class="p">();</span> <span class="w"> </span><span class="n">bar</span><span class="p">();</span><span class="w"> </span><span class="p">}</span> </pre></div> </td> <td><a href="#Lisp_style">Lisp</a> </td></tr> <tr> <td style="padding: 0 4px"><div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="cp">#define W(c,b) {while(c){b}}</span> <span class="n">W</span><span class="p">(</span><span class="n">x</span><span class="o">==</span><span class="n">y</span><span class="p">,</span><span class="n">f</span><span class="p">();</span><span class="n">b</span><span class="p">();)</span> </pre></div> </td> <td><a href="#APL_style">APL</a> </td></tr></tbody></table> <div class="mw-heading mw-heading2"><h2 id="C/C++_styles"><span id="C.2FC.2B.2B_styles"></span>C/C++ styles</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=4" title="Edit section: C/C++ styles"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Attributes of <a href="/wiki/C_language" class="mw-redirect" title="C language">C</a>, <a href="/wiki/C%2B%2B" title="C++">C++</a> and other <a href="/wiki/Curly-brace_programming_language" class="mw-redirect" title="Curly-brace programming language">curly-brace programming language</a> coding style include but are not limited to: </p> <ul><li>Placement of <a href="/wiki/Curly_braces" class="mw-redirect" title="Curly braces">braces</a> relative to other code elements</li> <li>Use of <a href="/wiki/Tab_character" class="mw-redirect" title="Tab character">tabs</a> or <a href="/wiki/Space_character" class="mw-redirect" title="Space character">spaces</a></li> <li>Wrapping single-statement blocks in braces. Advocates cite the advantage that resulting code is safer since inserting a statement cannot result in control flow that disagrees with indentation. A cited disadvantage is that the code is longer since one line is needed for the closing brace of a block (except for the <code>else if</code> construct and a <code>do{}while</code> block).</li></ul> <div class="mw-heading mw-heading3"><h3 id="K&R"><span id="K.26R"></span>K&R</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=5" title="Edit section: K&R"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The Kernighan & Ritchie (K&R) style is commonly used for C and C++ code and is the basis for many derivative styles. It is used in the original Unix kernel, <a href="/wiki/Brian_Kernighan" title="Brian Kernighan">Kernighan</a> and <a href="/wiki/Dennis_Ritchie" title="Dennis Ritchie">Ritchie</a>'s book <i><a href="/wiki/The_C_Programming_Language" title="The C Programming Language">The C Programming Language</a></i>, as well as Kernighan and <a href="/wiki/P._J._Plauger" title="P. J. Plauger">Plauger</a>'s book <i><a href="/wiki/The_Elements_of_Programming_Style" title="The Elements of Programming Style">The Elements of Programming Style</a></i>. </p><p>Although <i><a href="/wiki/The_C_Programming_Language" title="The C Programming Language">The C Programming Language</a></i> does not explicitly define this style, it follows it consistently. From the book: </p> <blockquote> <p>The position of braces is less important, although people hold passionate beliefs. We have chosen one of several popular styles. Pick a style that suits you, then use it consistently. </p> </blockquote> <p>In this style, a function has its opening and closing braces on their own lines and with the same indentation as the declaration, while the statements in the body of the function are indented an additional level. A multi-statement block inside a function, however, has its opening brace on the same line as its control clause while the closing brace remains on its own line unless followed by a keyword such as <code>else</code> or <code>while</code>. </p><p>Example code: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="nf">main</span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">argc</span><span class="p">,</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">argv</span><span class="p">[])</span> <span class="p">{</span> <span class="w"> </span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">do_something</span><span class="p">();</span> <span class="w"> </span><span class="n">do_something_else</span><span class="p">();</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">some_error</span><span class="p">)</span> <span class="w"> </span><span class="n">fix_issue</span><span class="p">();</span><span class="w"> </span><span class="c1">// single-statement block without braces</span> <span class="w"> </span><span class="k">else</span> <span class="w"> </span><span class="n">continue_as_usual</span><span class="p">();</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="n">final_thing</span><span class="p">();</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Egyptian_braces">Egyptian braces</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=6" title="Edit section: Egyptian braces"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><span class="anchor" id="Egyptian"></span> The non-<a href="/wiki/Typographic_alignment" title="Typographic alignment">aligned</a> braces of the multi-line blocks are nicknamed "Egyptian braces" (or "Egyptian brackets") for their resemblance to arms in some fanciful poses of ancient Egyptians.<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading4"><h4 id="Single_statements">Single statements</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=7" title="Edit section: Single statements"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A single-statement block does not have braces, which is a cause of easy-to-miss bugs such as the <a href="/wiki/Unreachable_code#goto_fail_bug" title="Unreachable code">goto fail bug</a>. </p> <div class="mw-heading mw-heading3"><h3 id="One_True_Brace">One True Brace</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=8" title="Edit section: One True Brace"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><span class="anchor" id="Variant:_1TBS"></span> <span class="anchor" id="1TBS"></span><span class="anchor" id="OTBS"></span><span class="anchor" id="1TBF"></span> </p><p>The <i>One True Brace Style</i> <sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup> (abbreviated 1TBS or OTBS<sup id="cite_ref-catb.org_9-0" class="reference"><a href="#cite_note-catb.org-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup>) is like the K&R style, but functions are formatted like multi-statement blocks with the opening brace on the same line as the declaration, and braces are <i>not</i> omitted for a single-statement block.<sup id="cite_ref-onetruestyle_10-0" class="reference"><a href="#cite_note-onetruestyle-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">bool</span><span class="w"> </span><span class="nf">is_negative</span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">x</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nb">true</span><span class="p">;</span> <span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="nb">false</span><span class="p">;</span> <span class="w"> </span><span class="p">}</span> <span class="p">}</span> </pre></div> <p>Although not required by languages such as C/C++, using braces for single-statement blocks ensures that inserting a statement does not result in control flow that disagrees with indenting, as seen for example in Apple's infamous <a href="/wiki/Unreachable_code#goto_fail_bug" title="Unreachable code">goto fail bug</a>. </p><p>Cited advantages include shorter code (than K&R) since the starting brace needs no extra line, that the ending brace lines up with the statement it conceptually belongs to, and the perceived stylistic consistency of using the same brace style in both function bodies and multi-line statement blocks.<sup id="cite_ref-kernel.coding-style_11-0" class="reference"><a href="#cite_note-kernel.coding-style-11"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup> </p><p>Sources disagree as to the meaning of One True Brace Style. Some say that it is the variation specified here,<sup id="cite_ref-onetruestyle_10-1" class="reference"><a href="#cite_note-onetruestyle-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> while others say it is "hacker jargon" for K&R.<sup id="cite_ref-jargon_12-0" class="reference"><a href="#cite_note-jargon-12"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Linux_kernel">Linux kernel</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=9" title="Edit section: Linux kernel"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The <a href="/wiki/Linux_kernel" title="Linux kernel">Linux kernel</a> source tree is styled in a variant of K&R.<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">[</span>13<span class="cite-bracket">]</span></a></sup> <a href="/wiki/Linus_Torvalds" title="Linus Torvalds">Linus Torvalds</a> advises contributors to follow it. Attributes include: </p> <ul><li>Uses <a href="/wiki/Tab_character" class="mw-redirect" title="Tab character">tab characters</a> for indentation (not spaces) and assumes <a href="/wiki/Tab_stop" title="Tab stop">tab stops</a> every 8 spaces</li> <li>Brace layout matches K&R, with the braces of function definitions on their own lines and the opening brace of compound statements on the same line as the control clause, separated by a space</li> <li>Labels in a <code>switch</code> statement are aligned with the enclosing block (there is only one level of indents)</li> <li>Maximum line length is 100 characters although the pre-2020 limit of 80 characters is preferred.<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">[</span>14<span class="cite-bracket">]</span></a></sup></li> <li>A single-statement body of a compound statement (such as if, while, and do-while) does not need to be surrounded by curly braces. If, however, one or more of the substatements in an <code>if-else</code> statement require braces, then both substatements should be wrapped in braces:</li></ul> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="kt">int</span><span class="w"> </span><span class="nf">power</span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">x</span><span class="p">,</span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">y</span><span class="p">)</span> <span class="p">{</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">result</span><span class="p">;</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">y</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span> <span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span> <span class="w"> </span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">y</span><span class="o">--</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">0</span><span class="p">)</span> <span class="w"> </span><span class="n">result</span><span class="w"> </span><span class="o">*=</span><span class="w"> </span><span class="n">x</span><span class="p">;</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">result</span><span class="p">;</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Java">Java</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=10" title="Edit section: Java"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A significant body of <a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a> code uses a variant of the K&R style in which the opening brace is on the same line not only for the blocks inside a function, but also for class or method declarations. This style is widespread largely because <a href="/wiki/Sun_Microsystems" title="Sun Microsystems">Sun Microsystems</a>'s original style guides<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span class="cite-bracket">[</span>15<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span class="cite-bracket">[</span>16<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-17" class="reference"><a href="#cite_note-17"><span class="cite-bracket">[</span>17<span class="cite-bracket">]</span></a></sup> used this K&R variant, and as a result, most of the standard source code for the <a href="/wiki/Java_Class_Library" title="Java Class Library">Java API</a> is written in this style. It is also a popular indentation style for <a href="/wiki/ActionScript" title="ActionScript">ActionScript</a> and <a href="/wiki/JavaScript" title="JavaScript">JavaScript</a>, along with the <a href="#Allman_style">Allman style</a>. </p> <div class="mw-heading mw-heading3"><h3 id="Stroustrup">Stroustrup</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=11" title="Edit section: Stroustrup"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><a href="/wiki/Bjarne_Stroustrup" title="Bjarne Stroustrup">Bjarne Stroustrup</a> adapted the K&R style for C++ in his books, such as <i>Programming: Principles and Practice using C++</i> and <i><a href="/wiki/The_C%2B%2B_Programming_Language" title="The C++ Programming Language">The C++ Programming Language</a></i>.<sup id="cite_ref-ppp_18-0" class="reference"><a href="#cite_note-ppp-18"><span class="cite-bracket">[</span>18<span class="cite-bracket">]</span></a></sup> </p><p>Unlike the variants above, Stroustrup does not use a "cuddled else". Thus, Stroustrup would write<sup id="cite_ref-ppp_18-1" class="reference"><a href="#cite_note-ppp-18"><span class="cite-bracket">[</span>18<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">puts</span><span class="p">(</span><span class="s">"Negative"</span><span class="p">);</span> <span class="w"> </span><span class="n">negative</span><span class="p">(</span><span class="n">x</span><span class="p">);</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">puts</span><span class="p">(</span><span class="s">"Non-negative"</span><span class="p">);</span> <span class="w"> </span><span class="n">nonnegative</span><span class="p">(</span><span class="n">x</span><span class="p">);</span> <span class="w"> </span><span class="p">}</span> </pre></div> <p>Stroustrup extends K&R style for classes, writing them as follows: </p> <div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span></span><span class="w"> </span><span class="k">class</span><span class="w"> </span><span class="nc">Vector</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">public</span><span class="o">:</span> <span class="w"> </span><span class="c1">// construct a Vector</span> <span class="w"> </span><span class="n">Vector</span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">s</span><span class="p">)</span><span class="w"> </span><span class="o">:</span><span class="n">elem</span><span class="p">(</span><span class="k">new</span><span class="w"> </span><span class="kt">double</span><span class="p">[</span><span class="n">s</span><span class="p">]),</span><span class="w"> </span><span class="n">sz</span><span class="p">(</span><span class="n">s</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="c1">// element access: subscripting</span> <span class="w"> </span><span class="kt">double</span><span class="o">&</span><span class="w"> </span><span class="k">operator</span><span class="p">[](</span><span class="kt">int</span><span class="w"> </span><span class="n">i</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">elem</span><span class="p">[</span><span class="n">i</span><span class="p">];</span><span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">size</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">sz</span><span class="p">;</span><span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="k">private</span><span class="o">:</span> <span class="w"> </span><span class="c1">// pointer to the elements</span> <span class="w"> </span><span class="kt">double</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">elem</span><span class="p">;</span> <span class="w"> </span><span class="c1">// number of elements</span> <span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">sz</span><span class="p">;</span> <span class="w"> </span><span class="p">};</span> </pre></div> <p>Stroustrup does not indent the labels <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">public:</code> and <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">private:</code>. Also, in this style, while the opening brace of a function starts on a new line, the opening brace of a class is on the same line as the class name. </p><p>Stroustrup allows writing short functions all on one line. Stroustrup style is a named indentation style available in the editor <a href="/wiki/Emacs" title="Emacs">Emacs</a>. Stroustrup encourages a K&R-derived style layout with C++ as stated in his modern <i>C++ Core Guidelines</i>.<sup id="cite_ref-19" class="reference"><a href="#cite_note-19"><span class="cite-bracket">[</span>19<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="BSD_KNF">BSD KNF</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=12" title="Edit section: BSD KNF"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The <a href="/wiki/Berkeley_Software_Distribution" title="Berkeley Software Distribution">Berkeley Software Distribution</a> (BSD) operating systems uses a style that is sometimes termed <a href="/wiki/Kernel_normal_form" class="mw-redirect" title="Kernel normal form">kernel normal form</a> (KNF). Although mostly intended for kernel code, it is also widely used in <a href="/wiki/Userland_(computing)" class="mw-redirect" title="Userland (computing)">userland</a> code. It is essentially a thoroughly documented variant of K&R style as used in the Bell Labs version 6 & 7 <a href="/wiki/Unix" title="Unix">Unix</a> source code.<sup id="cite_ref-C_Style_and_Coding_Standards_for_SunOS_20-0" class="reference"><a href="#cite_note-C_Style_and_Coding_Standards_for_SunOS-20"><span class="cite-bracket">[</span>20<span class="cite-bracket">]</span></a></sup> </p><p>The SunOS kernel and userland uses a similar indentation style.<sup id="cite_ref-C_Style_and_Coding_Standards_for_SunOS_20-1" class="reference"><a href="#cite_note-C_Style_and_Coding_Standards_for_SunOS-20"><span class="cite-bracket">[</span>20<span class="cite-bracket">]</span></a></sup> Like KNF, this also was based on AT&T style documents and is sometimes termed Bill Joy Normal Form.<sup id="cite_ref-DTraceToolkit_Style_Guide_21-0" class="reference"><a href="#cite_note-DTraceToolkit_Style_Guide-21"><span class="cite-bracket">[</span>21<span class="cite-bracket">]</span></a></sup> The SunOS guideline was published in 1996; ANSI C is discussed briefly. The correctness of the indentation of a list of source files can be verified by the <i>cstyle</i> program written by Bill Shannon.<sup id="cite_ref-C_Style_and_Coding_Standards_for_SunOS_20-2" class="reference"><a href="#cite_note-C_Style_and_Coding_Standards_for_SunOS-20"><span class="cite-bracket">[</span>20<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-DTraceToolkit_Style_Guide_21-1" class="reference"><a href="#cite_note-DTraceToolkit_Style_Guide-21"><span class="cite-bracket">[</span>21<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-illumos-gate_cstyle_22-0" class="reference"><a href="#cite_note-illumos-gate_cstyle-22"><span class="cite-bracket">[</span>22<span class="cite-bracket">]</span></a></sup> </p><p>In this style, the hard tabulator (ts in <a href="/wiki/Vi_(text_editor)" title="Vi (text editor)">vi</a>) is kept at eight columns, while a soft tabulator is often defined as a helper also (sw in vi), and set at four. The hard tabulators are used to indent code blocks, while a soft tabulator (four spaces) of additional indentation is used for all continuing lines that must be split over multiple lines. </p><p>Moreover, function calls do not use a space before the parenthesis, although C-language native statements such as <code>if</code>, <code>while</code>, <code>do</code>, <code>switch</code> and <code>return</code> do (in the case where <code>return</code> is used with parens). Functions that declare no local variables in their top-level block should also leave an empty line after their opening block brace. </p><p>Examples: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">something</span><span class="p">();</span> <span class="w"> </span><span class="n">something_else</span><span class="p">();</span> <span class="p">}</span> <span class="n">final_thing</span><span class="p">();</span> </pre></div> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">data</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="nb">NULL</span><span class="w"> </span><span class="o">&&</span><span class="w"> </span><span class="n">res</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">JS_DefineProperty</span><span class="p">(</span><span class="n">cx</span><span class="p">,</span><span class="w"> </span><span class="n">o</span><span class="p">,</span><span class="w"> </span><span class="s">"data"</span><span class="p">,</span> <span class="w"> </span><span class="n">STRING_TO_JSVAL</span><span class="p">(</span><span class="n">JS_NewStringCopyN</span><span class="p">(</span><span class="n">cx</span><span class="p">,</span><span class="w"> </span><span class="n">data</span><span class="p">,</span><span class="w"> </span><span class="n">res</span><span class="p">)),</span> <span class="w"> </span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="n">JSPROP_ENUMERATE</span><span class="p">)</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">QUEUE_EXCEPTION</span><span class="p">(</span><span class="s">"Internal error!"</span><span class="p">);</span> <span class="w"> </span><span class="k">goto</span><span class="w"> </span><span class="n">err</span><span class="p">;</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="n">PQfreemem</span><span class="p">(</span><span class="n">data</span><span class="p">);</span> <span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">JS_DefineProperty</span><span class="p">(</span><span class="n">cx</span><span class="p">,</span><span class="w"> </span><span class="n">o</span><span class="p">,</span><span class="w"> </span><span class="s">"data"</span><span class="p">,</span><span class="w"> </span><span class="n">OBJECT_TO_JSVAL</span><span class="p">(</span><span class="nb">NULL</span><span class="p">),</span> <span class="w"> </span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="n">JSPROP_ENUMERATE</span><span class="p">)</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">QUEUE_EXCEPTION</span><span class="p">(</span><span class="s">"Internal error!"</span><span class="p">);</span> <span class="w"> </span><span class="k">goto</span><span class="w"> </span><span class="n">err</span><span class="p">;</span> <span class="w"> </span><span class="p">}</span> <span class="p">}</span> </pre></div> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">static</span><span class="w"> </span><span class="n">JSBool</span> <span class="nf">pgresult_constructor</span><span class="p">(</span><span class="n">JSContext</span><span class="w"> </span><span class="o">*</span><span class="n">cx</span><span class="p">,</span><span class="w"> </span><span class="n">JSObject</span><span class="w"> </span><span class="o">*</span><span class="n">obj</span><span class="p">,</span><span class="w"> </span><span class="n">uintN</span><span class="w"> </span><span class="n">argc</span><span class="p">,</span> <span class="w"> </span><span class="n">jsval</span><span class="w"> </span><span class="o">*</span><span class="n">argv</span><span class="p">,</span><span class="w"> </span><span class="n">jsval</span><span class="w"> </span><span class="o">*</span><span class="n">rval</span><span class="p">)</span> <span class="p">{</span> <span class="w"> </span><span class="n">QUEUE_EXCEPTION</span><span class="p">(</span><span class="s">"PGresult class not user-instantiable"</span><span class="p">);</span> <span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="p">(</span><span class="n">JS_FALSE</span><span class="p">);</span> <span class="p">}</span> </pre></div> <div class="mw-heading mw-heading3"><h3 id="Allman">Allman</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=13" title="Edit section: Allman"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><span class="anchor" id="Allman"></span><span class="anchor" id="Allman_style"></span><span class="anchor" id="BSD/Allman_style"></span> </p><p>The Allman style is named after <a href="/wiki/Eric_Allman" title="Eric Allman">Eric Allman</a>. It is also sometimes termed <i>BSD style</i> since Allman wrote many of the utilities for <a href="/wiki/Berkeley_Software_Distribution" title="Berkeley Software Distribution">BSD</a> Unix (although this should not be confused with the different "BSD KNF style"; see above). </p><p>This style puts the brace associated with a control statement on the next line, indented to the same level as the control statement. Statements within the braces are indented to the next level.<sup id="cite_ref-jargon_12-1" class="reference"><a href="#cite_note-jargon-12"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span> <span class="p">{</span> <span class="w"> </span><span class="n">something</span><span class="p">();</span> <span class="w"> </span><span class="n">something_else</span><span class="p">();</span> <span class="p">}</span> <span class="n">final_thing</span><span class="p">();</span> </pre></div> <p>This style is similar to the standard indentation used by the <a href="/wiki/Pascal_(programming_language)" title="Pascal (programming language)">Pascal</a> languages and <a href="/wiki/Transact-SQL" title="Transact-SQL">Transact-SQL</a>, where the braces are equivalent to the keywords <code>begin</code> and <code>end</code>. </p> <div class="mw-highlight mw-highlight-lang-pascal mw-content-ltr" dir="ltr"><pre><span></span><span class="cm">(* Example Allman code indentation style in Pascal *)</span> <span class="k">procedure</span><span class="w"> </span><span class="nf">dosomething</span><span class="p">(</span><span class="n">x</span><span class="o">,</span><span class="w"> </span><span class="n">y</span><span class="o">:</span><span class="w"> </span><span class="kt">Integer</span><span class="p">)</span><span class="o">;</span> <span class="k">begin</span> <span class="w"> </span><span class="k">while</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="k">do</span> <span class="w"> </span><span class="k">begin</span> <span class="w"> </span><span class="n">something</span><span class="p">()</span><span class="o">;</span> <span class="w"> </span><span class="n">something_else</span><span class="p">()</span><span class="o">;</span> <span class="w"> </span><span class="k">end</span><span class="o">;</span> <span class="k">end</span><span class="o">;</span> </pre></div> <p>Consequences of this style are that the indented code is clearly set apart from the containing statement by lines that are almost all <a href="/wiki/Whitespace_character" title="Whitespace character">whitespace</a> and the closing brace lines up in the same column as the opening brace. Some people feel this makes it easy to find matching braces. The blocking style also delineates the block of code from the associated control statement. Commenting out or removing a control statement or block of code, or <a href="/wiki/Code_refactoring" title="Code refactoring">code refactoring</a>, are all less likely to introduce syntax errors via dangling or missing braces. Also, it is consistent with brace placement for the outer-function block. </p><p>For example, the following is still correct syntactically: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="c1">// while (x == y)</span> <span class="p">{</span> <span class="w"> </span><span class="n">something</span><span class="p">();</span> <span class="w"> </span><span class="n">something_else</span><span class="p">();</span> <span class="p">}</span> </pre></div> <p>As is this: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="c1">// for (int i=0; i < x; i++)</span> <span class="c1">// while (x == y)</span> <span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span> <span class="p">{</span> <span class="w"> </span><span class="n">something</span><span class="p">();</span> <span class="w"> </span><span class="n">something_else</span><span class="p">();</span> <span class="p">}</span> </pre></div> <p>Even like this, with conditional compilation: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="w"> </span><span class="kt">int</span><span class="w"> </span><span class="n">c</span><span class="p">;</span> <span class="cp">#ifdef HAS_GETCH</span> <span class="w"> </span><span class="k">while</span><span class="w"> </span><span class="p">((</span><span class="n">c</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">getch</span><span class="p">())</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="n">EOF</span><span class="p">)</span> <span class="cp">#else</span> <span class="w"> </span><span class="k">while</span><span class="w"> </span><span class="p">((</span><span class="n">c</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">getchar</span><span class="p">())</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="n">EOF</span><span class="p">)</span> <span class="cp">#endif</span> <span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">do_something</span><span class="p">(</span><span class="n">c</span><span class="p">);</span> <span class="w"> </span><span class="p">}</span> </pre></div> <div class="mw-heading mw-heading4"><h4 id="Variant:_Allman-8">Variant: Allman-8</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=14" title="Edit section: Variant: Allman-8"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Allman-8 uses the 8-space indentation tabs and 80-column limit of the Linux Kernel variant of K&R. The style purportedly helps improve readability on projectors. Also, the indentation size and column restriction help create a visual cue for identifying excessive nesting of code blocks. These advantages combine to help provide newer developers and learners implicit guidance to manage code complexity.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (October 2016)">citation needed</span></a></i>]</sup> </p> <div class="mw-heading mw-heading3"><h3 id="Whitesmiths">Whitesmiths</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=15" title="Edit section: Whitesmiths"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The Whitesmiths style, also sometimes termed Wishart style, was originally used in the documentation for the first commercial C compiler, the <a href="/wiki/Whitesmiths" title="Whitesmiths">Whitesmiths</a> Compiler. It was also popular in the early days of Windows, since it was used in three influential Windows programming books, <i><a href="/w/index.php?title=Programmer%27s_Guide_to_Windows&action=edit&redlink=1" class="new" title="Programmer's Guide to Windows (page does not exist)">Programmer's Guide to Windows</a></i> by <a href="/w/index.php?title=David_Durant&action=edit&redlink=1" class="new" title="David Durant (page does not exist)">Durant</a>, <a href="/w/index.php?title=Geta_Carlson&action=edit&redlink=1" class="new" title="Geta Carlson (page does not exist)">Carlson</a> & <a href="/w/index.php?title=Paul_Yao&action=edit&redlink=1" class="new" title="Paul Yao (page does not exist)">Yao</a>, <i><a href="/w/index.php?title=Programming_Windows&action=edit&redlink=1" class="new" title="Programming Windows (page does not exist)">Programming Windows</a></i> by <a href="/wiki/Charles_Petzold" title="Charles Petzold">Petzold</a>, and <i><a href="/w/index.php?title=Windows_3.0_Power_Programming_Techniques&action=edit&redlink=1" class="new" title="Windows 3.0 Power Programming Techniques (page does not exist)">Windows 3.0 Power Programming Techniques</a></i> by <a href="/wiki/Peter_Norton" title="Peter Norton">Norton</a> & Yao. </p><p>Whitesmiths, along with <a href="#Allman_style">Allman</a>, were claimed to have been the most common bracing styles in 1991 by the <a href="/wiki/Jargon_File" title="Jargon File">Jargon File</a>, with roughly equal popularity at the time.<sup id="cite_ref-jargon_12-2" class="reference"><a href="#cite_note-jargon-12"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-jargon243_23-0" class="reference"><a href="#cite_note-jargon243-23"><span class="cite-bracket">[</span>23<span class="cite-bracket">]</span></a></sup> </p><p>This style puts the brace associated with a control statement on the next line, indented. Statements within the braces are indented to the same level as the braces. </p><p>Like Ratliff style, the closing brace is indented the same as statements within the braces.<sup id="cite_ref-mcconnell_24-0" class="reference"><a href="#cite_note-mcconnell-24"><span class="cite-bracket">[</span>24<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span> <span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">something</span><span class="p">();</span> <span class="w"> </span><span class="n">something_else</span><span class="p">();</span> <span class="w"> </span><span class="p">}</span> <span class="n">final_thing</span><span class="p">();</span> </pre></div> <p>The advantages of this style are similar to those of the <a href="#Allman_style">Allman style</a>. Blocks are clearly set apart from control statements. The alignment of the braces with the block emphasizes that the full block is conceptually, and programmatically, one compound statement. Indenting the braces emphasizes that they are subordinate to the control statement. The ending brace no longer lines up with the statement, but instead with the opening brace. </p><p>An example: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">data</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="nb">NULL</span><span class="w"> </span><span class="o">&&</span><span class="w"> </span><span class="n">res</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">0</span><span class="p">)</span> <span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="o">!</span><span class="n">JS_DefineProperty</span><span class="p">(</span><span class="n">cx</span><span class="p">,</span><span class="w"> </span><span class="n">o</span><span class="p">,</span><span class="w"> </span><span class="s">"data"</span><span class="p">,</span><span class="w"> </span><span class="n">STRING_TO_JSVAL</span><span class="p">(</span><span class="n">JS_NewStringCopyN</span><span class="p">(</span><span class="n">cx</span><span class="p">,</span><span class="w"> </span><span class="n">data</span><span class="p">,</span><span class="w"> </span><span class="n">res</span><span class="p">)),</span><span class="w"> </span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="n">JSPROP_ENUMERATE</span><span class="p">))</span> <span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">QUEUE_EXCEPTION</span><span class="p">(</span><span class="s">"Internal error!"</span><span class="p">);</span> <span class="w"> </span><span class="k">goto</span><span class="w"> </span><span class="n">err</span><span class="p">;</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="n">PQfreemem</span><span class="p">(</span><span class="n">data</span><span class="p">);</span> <span class="w"> </span><span class="p">}</span> <span class="k">else</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="o">!</span><span class="n">JS_DefineProperty</span><span class="p">(</span><span class="n">cx</span><span class="p">,</span><span class="w"> </span><span class="n">o</span><span class="p">,</span><span class="w"> </span><span class="s">"data"</span><span class="p">,</span><span class="w"> </span><span class="n">OBJECT_TO_JSVAL</span><span class="p">(</span><span class="nb">NULL</span><span class="p">),</span><span class="w"> </span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="n">JSPROP_ENUMERATE</span><span class="p">))</span> <span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">QUEUE_EXCEPTION</span><span class="p">(</span><span class="s">"Internal error!"</span><span class="p">);</span> <span class="w"> </span><span class="k">goto</span><span class="w"> </span><span class="n">err</span><span class="p">;</span> <span class="w"> </span><span class="p">}</span> </pre></div> <p><code>else if</code> are treated as statement, much like the <code>#elif</code> preprocessor statement. </p> <div class="mw-heading mw-heading3"><h3 id="GNU">GNU</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=16" title="Edit section: GNU"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951" /><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/GNU_coding_standards" title="GNU coding standards">GNU coding standards</a></div> <p>Like the <a href="#Allman_style">Allman</a> and <a href="#Whitesmiths">Whitesmiths</a> styles, <a href="/wiki/GNU" title="GNU">GNU</a> style puts braces on a line by themselves, indented by two spaces, except when opening a function definition, where they are not indented.<sup id="cite_ref-gnu.org_25-0" class="reference"><a href="#cite_note-gnu.org-25"><span class="cite-bracket">[</span>25<span class="cite-bracket">]</span></a></sup> In either case, the contained code is indented by two spaces from the braces. </p><p>Popularised by <a href="/wiki/Richard_Stallman" title="Richard Stallman">Richard Stallman</a>, the layout may be influenced by his background of writing <a href="/wiki/Lisp_(programming_language)" title="Lisp (programming language)">Lisp</a> code.<sup id="cite_ref-gnu.org-lisp_26-0" class="reference"><a href="#cite_note-gnu.org-lisp-26"><span class="cite-bracket">[</span>26<span class="cite-bracket">]</span></a></sup> In Lisp, the equivalent to a block (a progn) is a first-class data entity, and giving it its own indentation level helps to emphasize that, whereas in C, a block is only syntax. This style can also be found in some <a href="/wiki/ALGOL" title="ALGOL">ALGOL</a> and <a href="/wiki/XPL" title="XPL">XPL</a> programming language textbooks from the 1960s and 1970s.<sup id="cite_ref-27" class="reference"><a href="#cite_note-27"><span class="cite-bracket">[</span>27<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-28" class="reference"><a href="#cite_note-28"><span class="cite-bracket">[</span>28<span class="cite-bracket">]</span></a></sup><sup class="noprint selfreference">[<i><a href="/wiki/Talk:Indentation_style#editorial_option_in_lieu_of_source" title="Talk:Indentation style">discuss</a></i>]</sup> </p><p>Although not indentation per se, GNU coding style also includes a space after a function name – before the left parenthesis of an argument list.<sup id="cite_ref-gnu.org_25-1" class="reference"><a href="#cite_note-gnu.org-25"><span class="cite-bracket">[</span>25<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">static</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span> <span class="nf">concat</span><span class="w"> </span><span class="p">(</span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">s1</span><span class="p">,</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">s2</span><span class="p">)</span> <span class="p">{</span> <span class="w"> </span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span> <span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">something</span><span class="w"> </span><span class="p">();</span> <span class="w"> </span><span class="n">something_else</span><span class="w"> </span><span class="p">();</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="n">final_thing</span><span class="w"> </span><span class="p">();</span> <span class="p">}</span> </pre></div> <p>This style combines the advantages of <a href="#Allman_style">Allman</a> and <a href="#Whitesmiths">Whitesmiths</a>, thereby removing the possible Whitesmiths disadvantage of braces not standing out from the block. One disadvantage is that the ending brace no longer lines up with the statement it conceptually belongs to. Another possible disadvantage is that it might waste space by using two visual levels of indents for one conceptual level, but in reality this is unlikely because, in systems with single-level indentation, each level is usually at least 4 spaces, same as 2 * 2 spaces in GNU style. </p><p>The <a href="/wiki/GNU_Coding_Standards" class="mw-redirect" title="GNU Coding Standards">GNU Coding Standards</a> recommend this style, and nearly all maintainers of <a href="/wiki/GNU_project" class="mw-redirect" title="GNU project">GNU project</a> software use it.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (February 2013)">citation needed</span></a></i>]</sup> </p><p>The <a href="/wiki/GNU_Emacs" title="GNU Emacs">GNU Emacs</a> text editor and the GNU systems' <a href="/wiki/Indent_(Unix)" title="Indent (Unix)">indent</a> command will reformat code according to this style by default.<sup id="cite_ref-29" class="reference"><a href="#cite_note-29"><span class="cite-bracket">[</span>29<span class="cite-bracket">]</span></a></sup> Those who do not use GNU Emacs, or similarly extensible/customisable editors, may find that the automatic indentation settings of their editor are unhelpful for this style. However, many editors defaulting to KNF style cope well with the GNU style when the tab width is set to two spaces; likewise, GNU Emacs adapts well to KNF style by simply setting the tab width to eight spaces. In both cases, automatic reformatting destroys the original spacing, but automatic line indenting will work properly. </p><p><a href="/wiki/Steve_McConnell" title="Steve McConnell">Steve McConnell</a>, in his book <a href="/wiki/Code_Complete" title="Code Complete">Code Complete</a>, advises against using this style: he marks a code sample which uses it with a "Coding Horror" icon, symbolizing especially dangerous code, and states that it impedes readability.<sup id="cite_ref-mcconnell_24-1" class="reference"><a href="#cite_note-mcconnell-24"><span class="cite-bracket">[</span>24<span class="cite-bracket">]</span></a></sup> The <a href="/wiki/Linux_kernel" title="Linux kernel">Linux kernel</a> coding style documentation also recommends against this style, urging readers to burn a copy of the GNU coding standards as a "great symbolic gesture".<sup id="cite_ref-kernel.coding-style_11-1" class="reference"><a href="#cite_note-kernel.coding-style-11"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Horstmann">Horstmann</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=17" title="Edit section: Horstmann"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The 1997 edition of <i>Computing Concepts with C++ Essentials</i> by Cay S. Horstmann adapts <a href="#Allman_style">Allman</a> by placing the first statement of a block on the same line as the opening brace. This style is also used in examples in Jensen and Wirth's <i>Pascal User Manual and Report</i>.<sup id="cite_ref-30" class="reference"><a href="#cite_note-30"><span class="cite-bracket">[</span>30<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">while</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">y</span><span class="p">)</span> <span class="p">{</span><span class="w"> </span><span class="n">something</span><span class="p">();</span> <span class="w"> </span><span class="n">something_else</span><span class="p">();</span> <span class="w"> </span><span class="c1">//...</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span> <span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">"Negative"</span><span class="p">);</span> <span class="w"> </span><span class="n">negative</span><span class="p">(</span><span class="n">x</span><span class="p">);</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="k">else</span> <span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">printf</span><span class="p">(</span><span class="s">"Non-negative"</span><span class="p">);</span> <span class="w"> </span><span class="n">nonnegative</span><span class="p">(</span><span class="n">x</span><span class="p">);</span> <span class="w"> </span><span class="p">}</span> <span class="p">}</span> <span class="n">final_thing</span><span class="p">();</span> </pre></div> <p>This style combines the advantages of <a href="#Allman_style">Allman</a> by keeping the vertical alignment of the braces for readability, and identifying blocks easily, with the saving of a line of the K&R style. However, the 2003 edition now uses Allman style throughout.<sup id="cite_ref-31" class="reference"><a href="#cite_note-31"><span class="cite-bracket">[</span>31<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Pico">Pico</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=18" title="Edit section: Pico"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>This is the style used most commonly in the language <a href="/wiki/Pico_(programming_language)" title="Pico (programming language)">Pico</a> by its designers. Pico lacks return statements, and uses semicolons as statement separators instead of terminators. It yields this syntax:<sup id="cite_ref-32" class="reference"><a href="#cite_note-32"><span class="cite-bracket">[</span>32<span class="cite-bracket">]</span></a></sup> </p> <pre>stuff(n): { x: 3 * n; y: do_stuff(x); y + x } </pre> <p>The advantages and disadvantages are similar to those of saving screen real estate with K&R style. An added advantage is that the starting and closing braces are consistent in application (both share space with a line of code), relative to K&R style, where one brace shares space with a line of code and one brace has a line alone. </p> <div class="mw-heading mw-heading3"><h3 id="Ratliff">Ratliff</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=19" title="Edit section: Ratliff"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In the book <i>Programmers at Work</i>, <sup id="cite_ref-lammers_33-0" class="reference"><a href="#cite_note-lammers-33"><span class="cite-bracket">[</span>33<span class="cite-bracket">]</span></a></sup> C. Wayne Ratliff, the original programmer behind the popular <a href="/wiki/DBase" title="DBase">dBase</a>-II and -III <a href="/wiki/Fourth-generation_programming_language" title="Fourth-generation programming language">fourth-generation programming languages</a>, discussed a style that is like 1TBS but the closing brace lines up with the indentation of the nested block. He indicated that the style was originally documented in material from <a href="/wiki/Digital_Research" title="Digital Research">Digital Research</a> Inc. This style has sometimes been termed <i>banner</i> style,<sup id="cite_ref-pattee_34-0" class="reference"><a href="#cite_note-pattee-34"><span class="cite-bracket">[</span>34<span class="cite-bracket">]</span></a></sup> possibly for the resemblance to a banner hanging from a pole. In this style, which is to <a href="#Whitesmiths">Whitesmiths</a> as K&R is to Allman, the closing control is indented the same as the last item in the list (and thus properly loses salience)<sup id="cite_ref-mcconnell_24-2" class="reference"><a href="#cite_note-mcconnell-24"><span class="cite-bracket">[</span>24<span class="cite-bracket">]</span></a></sup> The style can make visual scanning easier for some, since the <i>headers</i> of any block are the only thing exdented at that level (the theory being that the closing control of the prior block interferes with the visual flow of the next block header in the K&R and Allman styles). Kernighan and Plauger use this style in the Ratfor code in <i>Software Tools</i>.<sup id="cite_ref-35" class="reference"><a href="#cite_note-35"><span class="cite-bracket">[</span>35<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="w"> </span><span class="c1">// In C</span> <span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="mi">10</span><span class="p">;</span><span class="w"> </span><span class="n">i</span><span class="o">++</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">i</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="mi">2</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">do_something</span><span class="p">(</span><span class="n">i</span><span class="p">);</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">do_something_else</span><span class="p">(</span><span class="n">i</span><span class="p">);</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">}</span> </pre></div> <div class="mw-heading mw-heading2"><h2 id="C_derived_language_styles">C derived language styles</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=20" title="Edit section: C derived language styles"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The following styles are common for various languages derived from C that are both significantly similar and dissimilar. And, they can be adapted to C as well. They might be applied to C code written as part of a project <i>mostly</i> written in one of these other languages, where maintaining a consistent <i>look and feel</i> to the project's core code overrides considerations of using more conventional C style. </p> <div class="mw-heading mw-heading3"><h3 id="Lisp_style">Lisp style</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=21" title="Edit section: Lisp style"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>While <a href="#GNU">GNU style</a> is sometimes characterized as C code indented by a Lisp programmer, one might even go so far as to insert closing braces together in the last line of a block. This style makes indentation the only way to distinguish blocks of code, but has the advantage of containing no uninformative lines. This could easily be called the Lisp style because this style is very common in Lisp code. In Lisp, the grouping of identical braces at the end of expression trees is meant to signify that it is not the user's job to visually track nesting levels, only to understand the structure of the tree. </p><p>The traditional Lisp variant of this style prefers extremely narrow levels of indentation (typically two spaces) because Lisp code usually nests very deeply since Lisp features only <a href="/wiki/Expression_(computer_science)" title="Expression (computer science)">expressions</a>, with no distinct class of <a href="/wiki/Statement_(computer_science)" title="Statement (computer science)">statements</a>; function arguments are mostly indented to the same level to illustrate their shared status within the enclosing expression. This is also because, braces aside, Lisp is conventionally a very terse language, omitting even common forms of simple boilerplate code as uninformative, such as the <code>else</code> keyword in an <code>if : then | else</code> block, instead rendering it uniformly as <code>(if expr1 expr2 expr3)</code>. </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="c1">// C</span> <span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="mi">10</span><span class="p">;</span><span class="w"> </span><span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="w"> </span><span class="p">{</span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">i</span><span class="w"> </span><span class="o">%</span><span class="w"> </span><span class="mi">2</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span> <span class="w"> </span><span class="p">{</span><span class="n">do_something</span><span class="p">(</span><span class="n">i</span><span class="p">);}</span> <span class="w"> </span><span class="k">else</span> <span class="w"> </span><span class="p">{</span><span class="n">do_something_else</span><span class="p">(</span><span class="n">i</span><span class="p">);</span> <span class="w"> </span><span class="n">do_third_thing</span><span class="p">(</span><span class="n">i</span><span class="p">);}}</span> </pre></div> <p>  </p> <div class="mw-highlight mw-highlight-lang-lisp mw-content-ltr" dir="ltr"><pre><span></span><span class="c1">;; Lisp</span> <span class="p">(</span><span class="nb">dotimes</span><span class="w"> </span><span class="p">(</span><span class="nv">i</span><span class="w"> </span><span class="mi">10</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="nb">=</span><span class="w"> </span><span class="p">(</span><span class="nb">rem</span><span class="w"> </span><span class="nv">i</span><span class="w"> </span><span class="mi">2</span><span class="p">)</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="nv">do-something</span><span class="w"> </span><span class="nv">i</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="k">progn</span> <span class="w"> </span><span class="p">(</span><span class="nv">do-something-else</span><span class="w"> </span><span class="nv">i</span><span class="p">)</span> <span class="w"> </span><span class="p">(</span><span class="nv">do-third-thing</span><span class="w"> </span><span class="nv">i</span><span class="p">))))</span> </pre></div> <p><sup>Note: <code>progn</code> is a procedure for evaluating multiple sub-expressions sequentially for <a href="/wiki/Side_effect_(computer_science)" title="Side effect (computer science)">effects</a>, while discarding all but the final (nth) return value. If all return values are desired, the <code>values</code> procedure would be used.</sup> </p> <div class="mw-heading mw-heading3"><h3 id="Haskell_style">Haskell style</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=22" title="Edit section: Haskell style"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><a href="/wiki/Haskell_(programming_language)" class="mw-redirect" title="Haskell (programming language)">Haskell</a> layout can make the placement of braces optional, although braces and semicolons are allowed in the language. <sup id="cite_ref-36" class="reference"><a href="#cite_note-36"><span class="cite-bracket">[</span>36<span class="cite-bracket">]</span></a></sup> The two segments below are equally acceptable to the compiler: </p> <div class="mw-highlight mw-highlight-lang-haskell mw-content-ltr" dir="ltr"><pre><span></span><span class="nf">braceless</span><span class="w"> </span><span class="ow">=</span><span class="w"> </span><span class="kr">do</span> <span class="w"> </span><span class="n">text</span><span class="w"> </span><span class="ow"><-</span><span class="w"> </span><span class="n">getContents</span> <span class="w"> </span><span class="kr">let</span> <span class="w"> </span><span class="n">firstWord</span><span class="w"> </span><span class="ow">=</span><span class="w"> </span><span class="n">head</span><span class="w"> </span><span class="o">$</span><span class="w"> </span><span class="n">words</span><span class="w"> </span><span class="n">text</span> <span class="w"> </span><span class="n">bigWord</span><span class="w"> </span><span class="ow">=</span><span class="w"> </span><span class="n">map</span><span class="w"> </span><span class="n">toUpper</span><span class="w"> </span><span class="n">firstWord</span> <span class="w"> </span><span class="n">putStrLn</span><span class="w"> </span><span class="n">bigWord</span> <span class="nf">braceful</span><span class="w"> </span><span class="ow">=</span><span class="w"> </span><span class="kr">do</span> <span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">text</span><span class="w"> </span><span class="ow"><-</span><span class="w"> </span><span class="n">getContents</span> <span class="w"> </span><span class="p">;</span><span class="w"> </span><span class="kr">let</span> <span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">firstWord</span><span class="w"> </span><span class="ow">=</span><span class="w"> </span><span class="n">head</span><span class="w"> </span><span class="o">$</span><span class="w"> </span><span class="n">words</span><span class="w"> </span><span class="n">text</span> <span class="w"> </span><span class="p">;</span><span class="w"> </span><span class="n">bigWord</span><span class="w"> </span><span class="ow">=</span><span class="w"> </span><span class="n">map</span><span class="w"> </span><span class="n">toUpper</span><span class="w"> </span><span class="n">firstWord</span> <span class="w"> </span><span class="p">}</span> <span class="w"> </span><span class="p">;</span><span class="w"> </span><span class="n">putStrLn</span><span class="w"> </span><span class="n">bigWord</span> <span class="w"> </span><span class="p">}</span> </pre></div> <p>In Haskell, layout can replace braces. Usually the braces and semicolons are omitted for <a href="/wiki/Procedural_programming" title="Procedural programming">procedural</a> <code>do</code> sections and the program text in general, but the style is commonly used for lists, records and other syntactic elements made up of some pair of parentheses or braces, which are separated with commas or semicolons.<sup id="cite_ref-37" class="reference"><a href="#cite_note-37"><span class="cite-bracket">[</span>37<span class="cite-bracket">]</span></a></sup> If code following the keywords <code>where</code>, <code>let</code>, or <code>of</code> omits braces and semicolons, then indentation is significant.<sup id="cite_ref-38" class="reference"><a href="#cite_note-38"><span class="cite-bracket">[</span>38<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="APL_style">APL style</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=23" title="Edit section: APL style"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>For an example of how terse APL typically is, here is the implementation of the step function for the Game of Life: </p> <div class="mw-highlight mw-highlight-lang-apl mw-content-ltr" dir="ltr"><pre><span></span><span class="nv">life</span><span class="kd">←</span><span class="kt">{</span><span class="o">⊃</span><span class="m">1</span><span class="bp">⍵</span><span class="o">∨</span><span class="na">.</span><span class="o">∧</span><span class="m">3</span><span class="w"> </span><span class="m">4</span><span class="o">=+</span><span class="na">/</span><span class="o">+</span><span class="na">⌿</span><span class="m">¯1</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="m">1</span><span class="na">∘.</span><span class="o">⊖</span><span class="m">¯1</span><span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="m">1</span><span class="o">⌽</span><span class="na">¨</span><span class="o">⊂</span><span class="bp">⍵</span><span class="kt">}</span> </pre></div> <p><a href="/wiki/APL_(programming_language)" title="APL (programming language)">APL</a> style C resembles the terse style of APL code, and is commonly used in their implementations.<sup id="cite_ref-39" class="reference"><a href="#cite_note-39"><span class="cite-bracket">[</span>39<span class="cite-bracket">]</span></a></sup> This style was pioneered by <a href="/wiki/Arthur_Whitney_(computer_scientist)" title="Arthur Whitney (computer scientist)">Arthur Whitney</a>, and is heavily used in the implementation of <a href="/wiki/K_(programming_language)" title="K (programming language)">K</a>, Arthur's own project. The <a href="/wiki/J_(programming_language)" title="J (programming language)">J</a> programming language is implemented in this style as well. Notably, not all implementations of APL use this style of C, namely: GNU APL and Dyalog APL. </p><p>In addition to APL style C indentation, typically the names are shortened to either single or double characters: To reduce the amount of indentation, and expressions spanning multiple lines.<sup id="cite_ref-40" class="reference"><a href="#cite_note-40"><span class="cite-bracket">[</span>40<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="Indentation_size">Indentation size</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=24" title="Edit section: Indentation size"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Typically, programmers use the same width of whitespace to indent each block of code with commonly used widths varying from 1 to 4 spaces. </p><p>An experiment performed on PASCAL code in 1983, found that indentation size significantly affected comprehensibility. Indentation sizes between 2 and 4 characters proved optimal.<sup id="cite_ref-41" class="reference"><a href="#cite_note-41"><span class="cite-bracket">[</span>41<span class="cite-bracket">]</span></a></sup> </p><p>Although they both affect the general layout of code, indentation <i>size</i> is independent of the indentation <i>style</i> discussed here. </p> <div class="mw-heading mw-heading3"><h3 id="Tab_vs._space">Tab vs. space</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=25" title="Edit section: Tab vs. space"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Typically, a programmer uses a text editor that provides tab stops at fixed intervals (a number of spaces), to assist in maintaining whitespace according to a style. The interval is called the <i>tab width</i>. Sometimes the programmer stores the code with tab characters – one for each tab key press or they store a sequence of spaces equal in number to the tab width. </p><p>Storing <a href="/wiki/Tab_character" class="mw-redirect" title="Tab character">tab characters</a> in code can cause visual misalignment when viewed in different contexts, which counters the value of the indentation style. </p><p>Programmers lack consensus on storing tab characters. Proponents of storing tab characters cite ease of typing and smaller text files since a single tab character serves the purpose of multiple spaces. Opponents, such as <a href="/wiki/Jamie_Zawinski" title="Jamie Zawinski">Jamie Zawinski</a>, state that using spaces instead increases <a href="/wiki/Cross-platform" class="mw-redirect" title="Cross-platform">cross-platform</a> <a href="/wiki/Porting" title="Porting">portability</a>. <sup id="cite_ref-42" class="reference"><a href="#cite_note-42"><span class="cite-bracket">[</span>42<span class="cite-bracket">]</span></a></sup> Others, such as the writers of the <a href="/wiki/WordPress" title="WordPress">WordPress</a> coding standards, state the opposite: that hard tabs increase portability.<sup id="cite_ref-43" class="reference"><a href="#cite_note-43"><span class="cite-bracket">[</span>43<span class="cite-bracket">]</span></a></sup> A survey of the top 400,000 repositories on <a href="/wiki/GitHub" title="GitHub">GitHub</a> found that spaces are more common.<sup id="cite_ref-44" class="reference"><a href="#cite_note-44"><span class="cite-bracket">[</span>44<span class="cite-bracket">]</span></a></sup> </p><p>Many text editors, including <a href="/wiki/Notepad%2B%2B" title="Notepad++">Notepad++</a>, <a href="/wiki/TextEdit" title="TextEdit">TextEdit</a>, <a href="/wiki/Emacs" title="Emacs">Emacs</a>, <a href="/wiki/Vi_(text_editor)" title="Vi (text editor)">vi</a>, and <a href="/wiki/GNU_nano" title="GNU nano">nano</a>, can be configured to either store tab characters when entered via the tab key or to convert them to spaces (based on the configured tab width) so that tab characters are not added to the file when the tab key is pressed. Some editors can convert tab to space characters and vice versa. </p><p>Some <a href="/wiki/Terminal_pager" title="Terminal pager">text file pagers</a>, such as <a href="/wiki/Less_(Unix)" title="Less (Unix)">less</a>, can be configured for a tab width. Some tools such as <a href="/wiki/Expand_(Unix)" title="Expand (Unix)">expand</a>/<a href="/wiki/Unexpand" title="Unexpand">unexpand</a> can convert on the fly via filters. </p> <div class="mw-heading mw-heading2"><h2 id="Style_automation">Style automation</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=26" title="Edit section: Style automation"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1251242444">.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}</style><table class="box-Unreferenced_section plainlinks metadata ambox ambox-content ambox-Unreferenced" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><a href="/wiki/File:Question_book-new.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/50px-Question_book-new.svg.png" decoding="async" width="50" height="39" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/75px-Question_book-new.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/100px-Question_book-new.svg.png 2x" data-file-width="512" data-file-height="399" /></a></span></div></td><td class="mbox-text"><div class="mbox-text-span">This section <b>does not <a href="/wiki/Wikipedia:Citing_sources" title="Wikipedia:Citing sources">cite</a> any <a href="/wiki/Wikipedia:Verifiability" title="Wikipedia:Verifiability">sources</a></b>.<span class="hide-when-compact"> Please help <a href="/wiki/Special:EditPage/Indentation_style" title="Special:EditPage/Indentation style">improve this section</a> by <a href="/wiki/Help:Referencing_for_beginners" title="Help:Referencing for beginners">adding citations to reliable sources</a>. Unsourced material may be challenged and <a href="/wiki/Wikipedia:Verifiability#Burden_of_evidence" title="Wikipedia:Verifiability">removed</a>.</span> <span class="date-container"><i>(<span class="date">March 2024</span>)</i></span><span class="hide-when-compact"><i> (<small><a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove this message</a></small>)</i></span></div></td></tr></tbody></table> <p>A tool can automate formatting code per an indentation style, for example the <a href="/wiki/Unix" title="Unix">Unix</a> <code><a href="/wiki/Indent_(Unix)" title="Indent (Unix)">indent</a></code> command. </p><p><a href="/wiki/Emacs" title="Emacs">Emacs</a> provides commands to modify indentation, including hitting <code>Tab</code> on a given line. <code>M-x indent-region</code> indents code. </p><p><a href="/wiki/Elastic_tabstops" class="mw-redirect" title="Elastic tabstops">Elastic tabstops</a> is a tabulation style which requires support from the text editor, where entire blocks of text are kept automatically aligned when the length of one line in the block changes. </p> <div class="mw-heading mw-heading2"><h2 id="Losing_track_of_blocks">Losing track of blocks</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=27" title="Edit section: Losing track of blocks"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1251242444" /><table class="box-More_citations_needed plainlinks metadata ambox ambox-content ambox-Refimprove" role="presentation"><tbody><tr><td class="mbox-image"><div class="mbox-image-div"><span typeof="mw:File"><a href="/wiki/File:Question_book-new.svg" class="mw-file-description"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/50px-Question_book-new.svg.png" decoding="async" width="50" height="39" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/75px-Question_book-new.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/9/99/Question_book-new.svg/100px-Question_book-new.svg.png 2x" data-file-width="512" data-file-height="399" /></a></span></div></td><td class="mbox-text"><div class="mbox-text-span">This section <b>needs additional citations for <a href="/wiki/Wikipedia:Verifiability" title="Wikipedia:Verifiability">verification</a></b>.<span class="hide-when-compact"> Please help <a href="/wiki/Special:EditPage/Indentation_style" title="Special:EditPage/Indentation style">improve this article</a> by <a href="/wiki/Help:Referencing_for_beginners" title="Help:Referencing for beginners">adding citations to reliable sources</a> in this section. Unsourced material may be challenged and removed.<br /><small><span class="plainlinks"><i>Find sources:</i> <a rel="nofollow" class="external text" href="https://www.google.com/search?as_eq=wikipedia&q=%22Indentation+style%22">"Indentation style"</a> – <a rel="nofollow" class="external text" href="https://www.google.com/search?tbm=nws&q=%22Indentation+style%22+-wikipedia&tbs=ar:1">news</a> <b>·</b> <a rel="nofollow" class="external text" href="https://www.google.com/search?&q=%22Indentation+style%22&tbs=bkt:s&tbm=bks">newspapers</a> <b>·</b> <a rel="nofollow" class="external text" href="https://www.google.com/search?tbs=bks:1&q=%22Indentation+style%22+-wikipedia">books</a> <b>·</b> <a rel="nofollow" class="external text" href="https://scholar.google.com/scholar?q=%22Indentation+style%22">scholar</a> <b>·</b> <a rel="nofollow" class="external text" href="https://www.jstor.org/action/doBasicSearch?Query=%22Indentation+style%22&acc=on&wc=on">JSTOR</a></span></small></span> <span class="date-container"><i>(<span class="date">March 2024</span>)</i></span><span class="hide-when-compact"><i> (<small><a href="/wiki/Help:Maintenance_template_removal" title="Help:Maintenance template removal">Learn how and when to remove this message</a></small>)</i></span></div></td></tr></tbody></table> <p>In more complicated code, the programmer may lose track of block boundaries while reading the code. This is often experienced in large sections of code containing many compound statements nested to many levels of indentation. As the programmer scrolls to the bottom of a huge set of nested statements, they may lose track of context – such as the control structure at the top of the block. </p><p>Long compound statements can be a <a href="/wiki/Code_smell" title="Code smell">code smell</a> of <a href="/wiki/Cyclomatic_complexity" title="Cyclomatic complexity">over complexity</a> which can be solved by <a href="/wiki/Refactoring" class="mw-redirect" title="Refactoring">refactoring</a>. </p><p>Programmers who rely on counting the opening braces may have difficulty with indentation styles such as K&R, where the starting brace is not visually separated from its <a href="/wiki/Control_flow" title="Control flow">control statement</a>. Programmers who rely more on indentations will gain more from styles that are vertically compact, such as K&R, because the blocks are shorter. </p><p>To avoid losing track of control statements such as <code><a href="/wiki/For_loop" title="For loop">for</a></code>, a large indentation can be used, such as an 8-unit-wide hard tab, along with breaking up large functions into smaller and more readable functions. Linux is done this way, while using the K&R style. </p><p>Some text editors allow the programmer to jump between the two corresponding braces of a block. For example, <a href="/wiki/Vi_(text_editor)" title="Vi (text editor)">vi</a> jumps to the brace enclosing the same block as the one under the cursor when pressing the <code>%</code> key. Since the text cursor's <code>next</code> key (viz., the <code>n</code> key) retained directional positioning information (whether the <code>up</code> or <code>down</code> key was formerly pressed), the <a href="/wiki/Macro_(computer_science)#Keyboard_and_mouse_macros" title="Macro (computer science)">dot macro</a> (the <code>.</code> key) could then be used to place the text cursor on the next brace,<sup id="cite_ref-45" class="reference"><a href="#cite_note-45"><span class="cite-bracket">[</span>45<span class="cite-bracket">]</span></a></sup> given a suitable coding style. Instead, inspecting the block boundaries using the <code>%</code> key can be used to enforce a coding standard. </p><p>Another way to maintain block awareness, is to use comments after the closing brace. For example: </p> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">total</span><span class="p">;</span><span class="w"> </span><span class="n">i</span><span class="o">++</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">foo</span><span class="p">();</span> <span class="p">}</span><span class="w"> </span><span class="c1">//for (i)</span> </pre></div> <div class="mw-highlight mw-highlight-lang-c mw-content-ltr" dir="ltr"><pre><span></span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="n">bar</span><span class="p">();</span> <span class="p">}</span><span class="w"> </span><span class="c1">//if (x < 0)</span> </pre></div> <p>A disadvantage is maintaining the same code in multiple locations – above and below the block. </p><p>Some editors provide support for maintaining block awareness. A <a href="/wiki/Folding_editor" class="mw-redirect" title="Folding editor">folding editor</a> can hide (fold) and reveal (unfold) blocks by indentation level. Some editors highlight matching braces when the <a href="/wiki/Cursor_(user_interface)" title="Cursor (user interface)">cursor</a> is positioned next to one. </p> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=28" title="Edit section: See also"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="/wiki/Secondary_notation" title="Secondary notation">Secondary notation</a></li> <li><a href="/wiki/Syntax_highlighting" title="Syntax highlighting">Syntax highlighting</a></li> <li><a href="/wiki/Indentation_(typesetting)#Indentation_in_programming" title="Indentation (typesetting)">Indentation (typesetting) § Indentation in programming</a></li> <li><i><a href="/wiki/Silicon_Valley_(season_3)" class="mw-redirect" title="Silicon Valley (season 3)">Bachmanity Insanity</a></i>, a <i><a href="/wiki/Silicon_Valley_(TV_series)" title="Silicon Valley (TV series)">Silicon Valley</a></i> episode featuring the topic</li> <li><a href="/wiki/Source-code_formatter" class="mw-redirect" title="Source-code formatter">Source-code formatter</a></li></ul> <div class="mw-heading mw-heading2"><h2 id="References">References</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=29" title="Edit section: References"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1239543626">.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}</style><div class="reflist"> <div class="mw-references-wrap mw-references-columns"><ol class="references"> <li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}</style><cite id="CITEREFWeissman1974" class="citation techreport cs1">Weissman, Laurence Mark (1974). <a rel="nofollow" class="external text" href="https://archive.org/details/technicalreportc37univ"><i>A Methodology For Studying The Psychological Complexity of Computer Programs</i></a>. <i>CSRG-37</i> (Technical report). Computer Systems Research Group, <a href="/wiki/University_of_Toronto" title="University of Toronto">University of Toronto</a>. <a href="/wiki/OCLC_(identifier)" class="mw-redirect" title="OCLC (identifier)">OCLC</a> <a rel="nofollow" class="external text" href="https://search.worldcat.org/oclc/1085612768">1085612768</a>. technicalreportc37univ – via <a href="/wiki/Internet_Archive" title="Internet Archive">Internet Archive</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=report&rft.btitle=A+Methodology+For+Studying+The+Psychological+Complexity+of+Computer+Programs&rft.pub=Computer+Systems+Research+Group%2C+University+of+Toronto&rft.date=1974&rft_id=info%3Aoclcnum%2F1085612768&rft.aulast=Weissman&rft.aufirst=Laurence+Mark&rft_id=https%3A%2F%2Farchive.org%2Fdetails%2Ftechnicalreportc37univ&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFMorzeckHanenbergWergerGruhn2023" class="citation conference cs1">Morzeck, Johannes; Hanenberg, Stefan; Werger, Ole; Gruhn, Volker (2023). <a rel="nofollow" class="external text" href="https://drive.google.com/file/d/1UACm8yWCVVdghZw9m6x79fivRzixDubs/view"><i>Indentation in Source Code: A Randomized Control Trial on the Readability of Control Flows in Java Code with Large Effects</i></a>. Proceedings of the 18th International Conference on Software Technologies - ICSOFT. <a href="/wiki/Rome" title="Rome">Rome</a>, Italy. pp. <span class="nowrap">117–</span>128. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://doi.org/10.5220%2F0012087500003538">10.5220/0012087500003538</a></span>. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-989-758-665-1" title="Special:BookSources/978-989-758-665-1"><bdi>978-989-758-665-1</bdi></a> – via Stefan Hanenberg on <a href="/wiki/Google_Drive" title="Google Drive">Google Drive</a> (preprint).</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=conference&rft.btitle=Indentation+in+Source+Code%3A+A+Randomized+Control+Trial+on+the+Readability+of+Control+Flows+in+Java+Code+with+Large+Effects&rft.place=Rome%2C+Italy&rft.pages=%3Cspan+class%3D%22nowrap%22%3E117-%3C%2Fspan%3E128&rft.date=2023&rft_id=info%3Adoi%2F10.5220%2F0012087500003538&rft.isbn=978-989-758-665-1&rft.aulast=Morzeck&rft.aufirst=Johannes&rft.au=Hanenberg%2C+Stefan&rft.au=Werger%2C+Ole&rft.au=Gruhn%2C+Volker&rft_id=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F1UACm8yWCVVdghZw9m6x79fivRzixDubs%2Fview&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFHanenbergMorzeckGruhn2024" class="citation journal cs1">Hanenberg, Stefan; Morzeck, Johannes; Gruhn, Volker (9 August 2024). <a rel="nofollow" class="external text" href="https://doi.org/10.1007%2Fs10664-024-10531-y">"Indentation and reading time: a randomized control trial on the differences between generated indented and non-indented if-statements"</a>. <i>Empirical Software Engineering</i>. <b>29</b> (5): 134. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://doi.org/10.1007%2Fs10664-024-10531-y">10.1007/s10664-024-10531-y</a></span>. <a href="/wiki/ISSN_(identifier)" class="mw-redirect" title="ISSN (identifier)">ISSN</a> <a rel="nofollow" class="external text" href="https://search.worldcat.org/issn/1573-7616">1573-7616</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.jtitle=Empirical+Software+Engineering&rft.atitle=Indentation+and+reading+time%3A+a+randomized+control+trial+on+the+differences+between+generated+indented+and+non-indented+if-statements&rft.volume=29&rft.issue=5&rft.pages=134&rft.date=2024-08-09&rft_id=info%3Adoi%2F10.1007%2Fs10664-024-10531-y&rft.issn=1573-7616&rft.aulast=Hanenberg&rft.aufirst=Stefan&rft.au=Morzeck%2C+Johannes&rft.au=Gruhn%2C+Volker&rft_id=https%3A%2F%2Fdoi.org%2F10.1007%252Fs10664-024-10531-y&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFHanenbergMorzeckWergerGries2024" class="citation book cs1">Hanenberg, Stefan; Morzeck, Johannes; Werger, Ole; Gries, Stefan; Gruhn, Volker (2024). <a rel="nofollow" class="external text" href="https://link.springer.com/chapter/10.1007/978-3-031-61753-9_4">"Indentation and Reading Time: A Controlled Experiment on the Differences Between Generated Indented and Non-indented JSON Objects"</a>. In Fill, Hans-Georg; Domínguez Mayo, Francisco José; van Sinderen, Marten; Maciaszek, Leszek A. (eds.). <i>Software Technologies</i>. Communications in Computer and Information Science. Vol. 2104. Cham: Springer Nature Switzerland. pp. <span class="nowrap">50–</span>75. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1007%2F978-3-031-61753-9_4">10.1007/978-3-031-61753-9_4</a>. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-3-031-61753-9" title="Special:BookSources/978-3-031-61753-9"><bdi>978-3-031-61753-9</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.atitle=Indentation+and+Reading+Time%3A+A+Controlled+Experiment+on+the+Differences+Between+Generated+Indented+and+Non-indented+JSON+Objects&rft.btitle=Software+Technologies&rft.place=Cham&rft.series=Communications+in+Computer+and+Information+Science&rft.pages=%3Cspan+class%3D%22nowrap%22%3E50-%3C%2Fspan%3E75&rft.pub=Springer+Nature+Switzerland&rft.date=2024&rft_id=info%3Adoi%2F10.1007%2F978-3-031-61753-9_4&rft.isbn=978-3-031-61753-9&rft.aulast=Hanenberg&rft.aufirst=Stefan&rft.au=Morzeck%2C+Johannes&rft.au=Werger%2C+Ole&rft.au=Gries%2C+Stefan&rft.au=Gruhn%2C+Volker&rft_id=https%3A%2F%2Flink.springer.com%2Fchapter%2F10.1007%2F978-3-031-61753-9_4&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20180712222126/https://www.seas.upenn.edu/~cis120/current/java_style.shtml">"Java Style Guide"</a>. Archived from <a rel="nofollow" class="external text" href="https://www.seas.upenn.edu/~cis120/current/java_style.shtml#f">the original</a> on 12 July 2018. <q>Using either "Egyptian" curly braces or C-style curly braces is acceptable</q></cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Java+Style+Guide&rft_id=https%3A%2F%2Fwww.seas.upenn.edu%2F~cis120%2Fcurrent%2Fjava_style.shtml%23f&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://foldoc.org/Egyptian+brackets">"Egyptian brackets"</a>. <i><a href="/wiki/Foldoc" class="mw-redirect" title="Foldoc">Foldoc</a></i>. <q>A humourous [<i><a href="/wiki/Sic" title="Sic">sic</a></i>] term for K&R indent style, referring to the "one hand up in front, one down behind" pose</q></cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=Foldoc&rft.atitle=Egyptian+brackets&rft_id=http%3A%2F%2Ffoldoc.org%2FEgyptian%2Bbrackets&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://google.github.io/styleguide/jsguide.html#formatting-nonempty-blocks">"Google JavaScript Style Guide"</a>. <q>Braces follow the Kernighan and Ritchie style ("Egyptian brackets") for nonempty blocks and block-like constructs</q></cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Google+JavaScript+Style+Guide&rft_id=https%3A%2F%2Fgoogle.github.io%2Fstyleguide%2Fjsguide.html%23formatting-nonempty-blocks&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFDarwin1988" class="citation book cs1">Darwin, Ian F. (1988). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=vweTteq3OLQC&pg=PA51"><i>Checking C programs with Lint</i></a>. California: O'Reilly and Assosciates. p. 51. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/9780937175309" title="Special:BookSources/9780937175309"><bdi>9780937175309</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Checking+C+programs+with+Lint&rft.place=California&rft.pages=51&rft.pub=O%27Reilly+and+Assosciates&rft.date=1988&rft.isbn=9780937175309&rft.aulast=Darwin&rft.aufirst=Ian+F.&rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3DvweTteq3OLQC%26pg%3DPA51&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-catb.org-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-catb.org_9-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://catb.org/jargon/html/0/one-TBS.html">"1TBS"</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=1TBS&rft_id=http%3A%2F%2Fcatb.org%2Fjargon%2Fhtml%2F0%2Fone-TBS.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-onetruestyle-10"><span class="mw-cite-backlink">^ <a href="#cite_ref-onetruestyle_10-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-onetruestyle_10-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://2ality.com/2013/01/brace-styles.html">"Brace styles and JavaScript"</a>. 7 January 2013<span class="reference-accessdate">. Retrieved <span class="nowrap">8 November</span> 2018</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Brace+styles+and+JavaScript&rft.date=2013-01-07&rft_id=http%3A%2F%2F2ality.com%2F2013%2F01%2Fbrace-styles.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-kernel.coding-style-11"><span class="mw-cite-backlink">^ <a href="#cite_ref-kernel.coding-style_11-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-kernel.coding-style_11-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.kernel.org/doc/Documentation/process/coding-style.rst">"Linux kernel coding style"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">1 January</span> 2017</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Linux+kernel+coding+style&rft_id=https%3A%2F%2Fwww.kernel.org%2Fdoc%2FDocumentation%2Fprocess%2Fcoding-style.rst&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-jargon-12"><span class="mw-cite-backlink">^ <a href="#cite_ref-jargon_12-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-jargon_12-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-jargon_12-2"><sup><i><b>c</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.catb.org/jargon/html/I/indent-style.html">"The Jargon File"</a>. 4.4.7. 29 December 2003<span class="reference-accessdate">. Retrieved <span class="nowrap">18 August</span> 2014</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=The+Jargon+File&rft.series=4.4.7&rft.date=2003-12-29&rft_id=http%3A%2F%2Fwww.catb.org%2Fjargon%2Fhtml%2FI%2Findent-style.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text">A detailed description of the style is given at <a rel="nofollow" class="external text" href="https://www.kernel.org/doc/html/latest/process/coding-style.html">kernel.org</a>.</span> </li> <li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFLarabel" class="citation web cs1">Larabel, Michael. <a rel="nofollow" class="external text" href="https://www.phoronix.com/scan.php?page=news_item&px=Linux-Kernel-Deprecates-80-Col">"The Linux Kernel Deprecates The 80 Character Line Coding Style"</a>. <i>Phoronix</i>. Phoronix Media<span class="reference-accessdate">. Retrieved <span class="nowrap">1 May</span> 2022</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=Phoronix&rft.atitle=The+Linux+Kernel+Deprecates+The+80+Character+Line+Coding+Style&rft.aulast=Larabel&rft.aufirst=Michael&rft_id=https%3A%2F%2Fwww.phoronix.com%2Fscan.php%3Fpage%3Dnews_item%26px%3DLinux-Kernel-Deprecates-80-Col&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFReddy2000" class="citation web cs1">Reddy, Achut (30 March 2000). <a rel="nofollow" class="external text" href="https://web.archive.org/web/20060228095122/http://developers.sun.com/prodtech/cc/products/archive/whitepapers/java-style.pdf">"Java Coding Style Guide"</a> <span class="cs1-format">(PDF)</span>. Sun Microsystems. Archived from <a rel="nofollow" class="external text" href="http://developers.sun.com/prodtech/cc/products/archive/whitepapers/java-style.pdf">the original</a> <span class="cs1-format">(PDF)</span> on 28 February 2006<span class="reference-accessdate">. Retrieved <span class="nowrap">30 May</span> 2008</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Java+Coding+Style+Guide&rft.pub=Sun+Microsystems&rft.date=2000-03-30&rft.aulast=Reddy&rft.aufirst=Achut&rft_id=http%3A%2F%2Fdevelopers.sun.com%2Fprodtech%2Fcc%2Fproducts%2Farchive%2Fwhitepapers%2Fjava-style.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20080513084244/http://java.sun.com/docs/codeconv/CodeConventions.pdf">"Java Code Conventions"</a> <span class="cs1-format">(PDF)</span>. Sun Microsystems. 12 September 1997. Archived from <a rel="nofollow" class="external text" href="http://java.sun.com/docs/codeconv/CodeConventions.pdf">the original</a> <span class="cs1-format">(PDF)</span> on 13 May 2008<span class="reference-accessdate">. Retrieved <span class="nowrap">30 May</span> 2008</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Java+Code+Conventions&rft.pub=Sun+Microsystems&rft.date=1997-09-12&rft_id=http%3A%2F%2Fjava.sun.com%2Fdocs%2Fcodeconv%2FCodeConventions.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-17"><span class="mw-cite-backlink"><b><a href="#cite_ref-17">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html">"Code Conventions for the Java Programming Language"</a>. Sun Microsystems. 20 March 1997<span class="reference-accessdate">. Retrieved <span class="nowrap">30 May</span> 2008</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Code+Conventions+for+the+Java+Programming+Language&rft.pub=Sun+Microsystems&rft.date=1997-03-20&rft_id=http%3A%2F%2Fjava.sun.com%2Fdocs%2Fcodeconv%2Fhtml%2FCodeConvTOC.doc.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-ppp-18"><span class="mw-cite-backlink">^ <a href="#cite_ref-ppp_18-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-ppp_18-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFStroustrup2010" class="citation web cs1">Stroustrup, Bjarne (September 2010). <a rel="nofollow" class="external text" href="https://www.stroustrup.com/Programming/PPP-style.pdf">"PPP Style Guide"</a> <span class="cs1-format">(PDF)</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=PPP+Style+Guide&rft.date=2010-09&rft.aulast=Stroustrup&rft.aufirst=Bjarne&rft_id=https%3A%2F%2Fwww.stroustrup.com%2FProgramming%2FPPP-style.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-19"><span class="mw-cite-backlink"><b><a href="#cite_ref-19">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFStroustrup" class="citation web cs1">Stroustrup, Bjarne. <a rel="nofollow" class="external text" href="https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#nl17-use-kr-derived-layout">"C++ Core Guidelines"</a>. <i>GitHub</i><span class="reference-accessdate">. Retrieved <span class="nowrap">3 November</span> 2018</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=GitHub&rft.atitle=C%2B%2B+Core+Guidelines&rft.aulast=Stroustrup&rft.aufirst=Bjarne&rft_id=https%3A%2F%2Fgithub.com%2Fisocpp%2FCppCoreGuidelines%2Fblob%2Fmaster%2FCppCoreGuidelines.md%23nl17-use-kr-derived-layout&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-C_Style_and_Coding_Standards_for_SunOS-20"><span class="mw-cite-backlink">^ <a href="#cite_ref-C_Style_and_Coding_Standards_for_SunOS_20-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-C_Style_and_Coding_Standards_for_SunOS_20-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-C_Style_and_Coding_Standards_for_SunOS_20-2"><sup><i><b>c</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFShannon1996" class="citation news cs1">Shannon, Bill (19 August 1996). <a rel="nofollow" class="external text" href="https://www.cis.upenn.edu/~lee/06cse480/data/cstyle.ms.pdf">"C Style and Coding Standards for SunOS"</a> <span class="cs1-format">(PDF)</span>. 1.8. Sun Microsystems, Inc<span class="reference-accessdate">. Retrieved <span class="nowrap">15 June</span> 2019</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.atitle=C+Style+and+Coding+Standards+for+SunOS&rft.date=1996-08-19&rft.aulast=Shannon&rft.aufirst=Bill&rft_id=https%3A%2F%2Fwww.cis.upenn.edu%2F~lee%2F06cse480%2Fdata%2Fcstyle.ms.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-DTraceToolkit_Style_Guide-21"><span class="mw-cite-backlink">^ <a href="#cite_ref-DTraceToolkit_Style_Guide_21-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-DTraceToolkit_Style_Guide_21-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFGregg" class="citation web cs1">Gregg, Brendan. <a rel="nofollow" class="external text" href="http://www.brendangregg.com/DTraceToolkit/style.html">"DTraceToolkit Style Guide"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">6 February</span> 2015</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=DTraceToolkit+Style+Guide&rft.aulast=Gregg&rft.aufirst=Brendan&rft_id=http%3A%2F%2Fwww.brendangregg.com%2FDTraceToolkit%2Fstyle.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-illumos-gate_cstyle-22"><span class="mw-cite-backlink"><b><a href="#cite_ref-illumos-gate_cstyle_22-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFShannon1998" class="citation web cs1">Shannon, Bill (9 September 1998). <a rel="nofollow" class="external text" href="https://github.com/illumos/illumos-gate/blob/master/usr/src/tools/scripts/cstyle.pl">"cstyle.pl"</a>. <i>illumos-gate</i>. 1.58. Sun Microsystems, Inc<span class="reference-accessdate">. Retrieved <span class="nowrap">6 February</span> 2015</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=illumos-gate&rft.atitle=cstyle.pl&rft.date=1998-09-09&rft.aulast=Shannon&rft.aufirst=Bill&rft_id=https%3A%2F%2Fgithub.com%2Fillumos%2Fillumos-gate%2Fblob%2Fmaster%2Fusr%2Fsrc%2Ftools%2Fscripts%2Fcstyle.pl&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-jargon243-23"><span class="mw-cite-backlink"><b><a href="#cite_ref-jargon243_23-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.catb.org/~esr/jargon/oldversions/jarg243.txt">"The Jargon File (Version 2.4.3)"</a>. 2.4.3. 23 January 1991<span class="reference-accessdate">. Retrieved <span class="nowrap">14 May</span> 2024</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=The+Jargon+File+%28Version+2.4.3%29&rft.series=2.4.3&rft.date=1991-01-23&rft_id=http%3A%2F%2Fwww.catb.org%2F~esr%2Fjargon%2Foldversions%2Fjarg243.txt&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-mcconnell-24"><span class="mw-cite-backlink">^ <a href="#cite_ref-mcconnell_24-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-mcconnell_24-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-mcconnell_24-2"><sup><i><b>c</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFMcConnell2004" class="citation book cs1"><a href="/wiki/Steve_McConnell" title="Steve McConnell">McConnell, Steve</a> (2004). <span class="id-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/codecomplete0000mcco"><i>Code Complete: A practical handbook of software construction</i></a></span>. Redmond, WA: Microsoft Press. pp. <a rel="nofollow" class="external text" href="https://archive.org/details/codecomplete0000mcco/page/746">746–747</a>. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-0-7356-1967-8" title="Special:BookSources/978-0-7356-1967-8"><bdi>978-0-7356-1967-8</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Code+Complete%3A+A+practical+handbook+of+software+construction&rft.place=Redmond%2C+WA&rft.pages=746-747&rft.pub=Microsoft+Press&rft.date=2004&rft.isbn=978-0-7356-1967-8&rft.aulast=McConnell&rft.aufirst=Steve&rft_id=https%3A%2F%2Farchive.org%2Fdetails%2Fcodecomplete0000mcco&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-gnu.org-25"><span class="mw-cite-backlink">^ <a href="#cite_ref-gnu.org_25-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-gnu.org_25-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.gnu.org/prep/standards/html_node/Formatting.html">"Formatting Your Source Code"</a>. <i><a href="/wiki/GNU_Coding_Standards" class="mw-redirect" title="GNU Coding Standards">GNU Coding Standards</a></i><span class="reference-accessdate">. Retrieved <span class="nowrap">6 June</span> 2016</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=GNU+Coding+Standards&rft.atitle=Formatting+Your+Source+Code&rft_id=https%3A%2F%2Fwww.gnu.org%2Fprep%2Fstandards%2Fhtml_node%2FFormatting.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-gnu.org-lisp-26"><span class="mw-cite-backlink"><b><a href="#cite_ref-gnu.org-lisp_26-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFStallman2002" class="citation web cs1">Stallman, Richard (28 October 2002). <a rel="nofollow" class="external text" href="https://www.gnu.org/gnu/rms-lisp.html">"My Lisp Experiences and the Development of GNU Emacs (Transcript of speech at the International Lisp Conference)"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">6 June</span> 2016</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=My+Lisp+Experiences+and+the+Development+of+GNU+Emacs+%28Transcript+of+speech+at+the+International+Lisp+Conference%29&rft.date=2002-10-28&rft.aulast=Stallman&rft.aufirst=Richard&rft_id=https%3A%2F%2Fwww.gnu.org%2Fgnu%2Frms-lisp.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-27"><span class="mw-cite-backlink"><b><a href="#cite_ref-27">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFBaumannFelicianoBauerSamelson1964" class="citation book cs1 cs1-prop-interwiki-linked-name"><a href="https://de.wikipedia.org/wiki/Richard_Baumann_(Mathematiker)" class="extiw" title="de:Richard Baumann (Mathematiker)">Baumann, Richard</a> <span class="cs1-format">[in German]</span>; Feliciano, Manuel; <a href="/wiki/Friedrich_Ludwig_Bauer" class="mw-redirect" title="Friedrich Ludwig Bauer">Bauer, Friedrich Ludwig</a>; <a href="/wiki/Klaus_Samelson" title="Klaus Samelson">Samelson, Klaus</a> (1964). <a rel="nofollow" class="external text" href="https://archive.org/details/introductiontoal00baum"><i>Introduction to ALGOL – A primer for the non-specialist, emphasizing the practical uses of the algorithmic language</i></a>. Series in Automatic Computation. Englewood Cliffs, New Jersey, USA: <a href="/wiki/Prentice-Hall,_Inc." class="mw-redirect" title="Prentice-Hall, Inc.">Prentice-Hall, Inc.</a> <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/0-13-477828-6" title="Special:BookSources/0-13-477828-6"><bdi>0-13-477828-6</bdi></a>. <a href="/wiki/LCCN_(identifier)" class="mw-redirect" title="LCCN (identifier)">LCCN</a> <a rel="nofollow" class="external text" href="https://lccn.loc.gov/64-10740">64-10740</a>. ark:/13960/t6qz35p37<span class="reference-accessdate">. Retrieved <span class="nowrap">23 October</span> 2022</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Introduction+to+ALGOL+%E2%80%93+A+primer+for+the+non-specialist%2C+emphasizing+the+practical+uses+of+the+algorithmic+language&rft.place=Englewood+Cliffs%2C+New+Jersey%2C+USA&rft.series=Series+in+Automatic+Computation&rft.pub=Prentice-Hall%2C+Inc.&rft.date=1964&rft_id=info%3Alccn%2F64-10740&rft.isbn=0-13-477828-6&rft.aulast=Baumann&rft.aufirst=Richard&rft.au=Feliciano%2C+Manuel&rft.au=Bauer%2C+Friedrich+Ludwig&rft.au=Samelson%2C+Klaus&rft_id=https%3A%2F%2Farchive.org%2Fdetails%2Fintroductiontoal00baum&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-28"><span class="mw-cite-backlink"><b><a href="#cite_ref-28">^</a></b></span> <span class="reference-text">W. M. McKeeman, J. J. Horning, and D. B. Wortman, <i>A Compiler Generator</i>, 1970, <a rel="nofollow" class="external free" href="https://archive.org/details/compilergenerato00mcke">https://archive.org/details/compilergenerato00mcke</a></span> </li> <li id="cite_note-29"><span class="mw-cite-backlink"><b><a href="#cite_ref-29">^</a></b></span> <span class="reference-text">Tested on the sample source code above on Ubuntu 18.04 with GNU indent 2.2.11 and GNU Emacs 25.2.2 started with <code>emacs --no-init-file</code>.</span> </li> <li id="cite_note-30"><span class="mw-cite-backlink"><b><a href="#cite_ref-30">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFJensenWirth1974" class="citation book cs1">Jensen, Kathleen; Wirth, Niklaus (1974). <i>PASCAL User Manual and Report</i>. Springer-Verlag.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=PASCAL+User+Manual+and+Report&rft.pub=Springer-Verlag&rft.date=1974&rft.aulast=Jensen&rft.aufirst=Kathleen&rft.au=Wirth%2C+Niklaus&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-31"><span class="mw-cite-backlink"><b><a href="#cite_ref-31">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://www.horstmann.com/bigcpp/styleguide.html">Horstmann Style Guide</a></span> </li> <li id="cite_note-32"><span class="mw-cite-backlink"><b><a href="#cite_ref-32">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFOhno2013" class="citation book cs1">Ohno, Asako (2013). "A methodology to teach exemplary coding style considering students' coding style feature contains fluctuations". <i>2013 IEEE Frontiers in Education Conference (FIE)</i>. pp. <span class="nowrap">1908–</span>1910. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1109%2Ffie.2013.6685167">10.1109/fie.2013.6685167</a>. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/9781467352611" title="Special:BookSources/9781467352611"><bdi>9781467352611</bdi></a>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:28385526">28385526</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.atitle=A+methodology+to+teach+exemplary+coding+style+considering+students%27+coding+style+feature+contains+fluctuations&rft.btitle=2013+IEEE+Frontiers+in+Education+Conference+%28FIE%29&rft.pages=%3Cspan+class%3D%22nowrap%22%3E1908-%3C%2Fspan%3E1910&rft.date=2013&rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A28385526%23id-name%3DS2CID&rft_id=info%3Adoi%2F10.1109%2Ffie.2013.6685167&rft.isbn=9781467352611&rft.aulast=Ohno&rft.aufirst=Asako&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-lammers-33"><span class="mw-cite-backlink"><b><a href="#cite_ref-lammers_33-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFLammers1986" class="citation book cs1">Lammers, Susan (1986). <span class="id-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/programmersatwor00lamm_0"><i>Programmers at Work</i></a></span>. Microsoft Press. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-0-914845-71-3" title="Special:BookSources/978-0-914845-71-3"><bdi>978-0-914845-71-3</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Programmers+at+Work&rft.pub=Microsoft+Press&rft.date=1986&rft.isbn=978-0-914845-71-3&rft.aulast=Lammers&rft.aufirst=Susan&rft_id=https%3A%2F%2Farchive.org%2Fdetails%2Fprogrammersatwor00lamm_0&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-pattee-34"><span class="mw-cite-backlink"><b><a href="#cite_ref-pattee_34-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFPattee" class="citation web cs1">Pattee, Jim. <a rel="nofollow" class="external text" href="http://astyle.sourceforge.net/astyle.html">"Artistic Style 2.05 Documentation"</a>. <i>Artistic Style</i><span class="reference-accessdate">. Retrieved <span class="nowrap">24 April</span> 2015</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=Artistic+Style&rft.atitle=Artistic+Style+2.05+Documentation&rft.aulast=Pattee&rft.aufirst=Jim&rft_id=http%3A%2F%2Fastyle.sourceforge.net%2Fastyle.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-35"><span class="mw-cite-backlink"><b><a href="#cite_ref-35">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFKernighanPlauger1976" class="citation book cs1">Kernighan, Brian W.; Plauger, P. J. (1976). <span class="id-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/softwaretools00kern"><i>Software Tools</i></a></span>. Addison-Wesley. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/9780201036695" title="Special:BookSources/9780201036695"><bdi>9780201036695</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Software+Tools&rft.pub=Addison-Wesley&rft.date=1976&rft.isbn=9780201036695&rft.aulast=Kernighan&rft.aufirst=Brian+W.&rft.au=Plauger%2C+P.+J.&rft_id=https%3A%2F%2Farchive.org%2Fdetails%2Fsoftwaretools00kern&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-36"><span class="mw-cite-backlink"><b><a href="#cite_ref-36">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.haskell.org/onlinereport/lexemes.html">"The Haskell 98 Report"</a>. <i>haskell.org</i><span class="reference-accessdate">. Retrieved <span class="nowrap">3 March</span> 2016</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=haskell.org&rft.atitle=The+Haskell+98+Report&rft_id=https%3A%2F%2Fwww.haskell.org%2Fonlinereport%2Flexemes.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-37"><span class="mw-cite-backlink"><b><a href="#cite_ref-37">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFLipovača" class="citation web cs1">Lipovača, Miran. <a rel="nofollow" class="external text" href="http://learnyouahaskell.com/making-our-own-types-and-typeclasses">"Making Our Own Types and Typeclasses"</a>. <i>learnyouahaskell.com</i><span class="reference-accessdate">. Retrieved <span class="nowrap">3 February</span> 2016</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=learnyouahaskell.com&rft.atitle=Making+Our+Own+Types+and+Typeclasses&rft.aulast=Lipova%C4%8Da&rft.aufirst=Miran&rft_id=http%3A%2F%2Flearnyouahaskell.com%2Fmaking-our-own-types-and-typeclasses&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-38"><span class="mw-cite-backlink"><b><a href="#cite_ref-38">^</a></b></span> <span class="reference-text">Haskell Report 1.2 (1992), p.131 B.4 "Layout"</span> </li> <li id="cite_note-39"><span class="mw-cite-backlink"><b><a href="#cite_ref-39">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.jsoftware.com/ioj/iojATW.htm">"The J Incunabulum"</a>. <i>jsoftware.com</i><span class="reference-accessdate">. Retrieved <span class="nowrap">19 May</span> 2022</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=jsoftware.com&rft.atitle=The+J+Incunabulum&rft_id=https%3A%2F%2Fwww.jsoftware.com%2Fioj%2FiojATW.htm&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-40"><span class="mw-cite-backlink"><b><a href="#cite_ref-40">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://github.com/jsoftware/jsource/tree/master/jsrc">"The J source code"</a>. <i>github.com</i><span class="reference-accessdate">. Retrieved <span class="nowrap">12 September</span> 2024</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=github.com&rft.atitle=The+J+source+code&rft_id=https%3A%2F%2Fgithub.com%2Fjsoftware%2Fjsource%2Ftree%2Fmaster%2Fjsrc&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-41"><span class="mw-cite-backlink"><b><a href="#cite_ref-41">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFMiaraMusselmanNavarroShneiderman1983" class="citation journal cs1">Miara, Richard J.; Musselman, Joyce A.; Navarro, Juan A. & Shneiderman, Ben (November 1983). <a rel="nofollow" class="external text" href="http://www.cs.umd.edu/~ben/papers/Miara1983Program.pdf">"Program Indentation and Comprehensibility"</a> <span class="cs1-format">(PDF)</span>. <i>Communications of the ACM</i>. <b>26</b> (11): <span class="nowrap">861–</span>867. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F182.358437">10.1145/182.358437</a>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:11767796">11767796</a><span class="reference-accessdate">. Retrieved <span class="nowrap">3 August</span> 2017</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.jtitle=Communications+of+the+ACM&rft.atitle=Program+Indentation+and+Comprehensibility&rft.volume=26&rft.issue=11&rft.pages=%3Cspan+class%3D%22nowrap%22%3E861-%3C%2Fspan%3E867&rft.date=1983-11&rft_id=info%3Adoi%2F10.1145%2F182.358437&rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A11767796%23id-name%3DS2CID&rft.aulast=Miara&rft.aufirst=Richard+J.&rft.au=Musselman%2C+Joyce+A.&rft.au=Navarro%2C+Juan+A.&rft.au=Shneiderman%2C+Ben&rft_id=http%3A%2F%2Fwww.cs.umd.edu%2F~ben%2Fpapers%2FMiara1983Program.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-42"><span class="mw-cite-backlink"><b><a href="#cite_ref-42">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFZawinski2000" class="citation web cs1">Zawinski, Jamie (2000). <a rel="nofollow" class="external text" href="https://www.jwz.org/doc/tabs-vs-spaces.html">"Tabs versus Spaces: An Eternal Holy War"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">6 June</span> 2016</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Tabs+versus+Spaces%3A+An+Eternal+Holy+War&rft.date=2000&rft.aulast=Zawinski&rft.aufirst=Jamie&rft_id=http%3A%2F%2Fwww.jwz.org%2Fdoc%2Ftabs-vs-spaces.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-43"><span class="mw-cite-backlink"><b><a href="#cite_ref-43">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://codex.wordpress.org/WordPress_Coding_Standards#Indentation">"WordPress Coding Standards"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">6 June</span> 2016</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=WordPress+Coding+Standards&rft_id=http%3A%2F%2Fcodex.wordpress.org%2FWordPress_Coding_Standards%23Indentation&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-44"><span class="mw-cite-backlink"><b><a href="#cite_ref-44">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFHoffa2017" class="citation web cs1">Hoffa, Felipe (26 July 2017). <a rel="nofollow" class="external text" href="https://medium.com/@hoffa/400-000-github-repositories-1-billion-files-14-terabytes-of-code-spaces-or-tabs-7cfe0b5dd7fd">"400,000 GitHub repositories, 1 billion files, 14 terabytes of code: Spaces or Tabs?"</a>. <i>Medium</i><span class="reference-accessdate">. Retrieved <span class="nowrap">9 July</span> 2019</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=Medium&rft.atitle=400%2C000+GitHub+repositories%2C+1+billion+files%2C+14+terabytes+of+code%3A+Spaces+or+Tabs%3F&rft.date=2017-07-26&rft.aulast=Hoffa&rft.aufirst=Felipe&rft_id=https%3A%2F%2Fmedium.com%2F%40hoffa%2F400-000-github-repositories-1-billion-files-14-terabytes-of-code-spaces-or-tabs-7cfe0b5dd7fd&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> <li id="cite_note-45"><span class="mw-cite-backlink"><b><a href="#cite_ref-45">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><cite id="CITEREFLamb1998" class="citation book cs1">Lamb, Linda (1998). <span class="id-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/learningvieditor00lamb"><i>Learning the vi editor</i></a></span>. O'Reilly. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/9781565924260" title="Special:BookSources/9781565924260"><bdi>9781565924260</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Learning+the+vi+editor&rft.pub=O%27Reilly&rft.date=1998&rft.isbn=9781565924260&rft.aulast=Lamb&rft.aufirst=Linda&rft_id=https%3A%2F%2Farchive.org%2Fdetails%2Flearningvieditor00lamb&rfr_id=info%3Asid%2Fen.wikipedia.org%3AIndentation+style" class="Z3988"></span></span> </li> </ol></div></div> <div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=30" title="Edit section: External links"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a rel="nofollow" class="external text" href="http://syque.com/cstyle/index.htm"><i>C Style: Standards and Guidelines: Defining Programming Standards for Professional C Programmers</i></a>, Prentice Hall, <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/0-13-116898-3" title="Special:BookSources/0-13-116898-3">0-13-116898-3</a> / <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222" /><a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-0-13-116898-5" title="Special:BookSources/978-0-13-116898-5">978-0-13-116898-5</a> (full text is also online). Straker, David (1992).</li> <li><a rel="nofollow" class="external text" href="http://milan.adamovsky.com/2010/08/contextual-indent.html">Contextual Indent</a></li> <li><a rel="nofollow" class="external text" href="https://www.gnu.org/prep/standards/standards.html">GNU Coding Standards</a></li></ul> <div class="mw-heading mw-heading3"><h3 id="Tabs_and_spaces">Tabs and spaces</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Indentation_style&action=edit&section=31" title="Edit section: Tabs and spaces"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a rel="nofollow" class="external text" href="https://www.jwz.org/doc/tabs-vs-spaces.html"><i>Tabs versus Spaces: An Eternal Holy War</i></a> by Jamie Zawinski</li> <li><a rel="nofollow" class="external text" href="http://adamspiers.org/computing/why_no_tabs.html"><i>Why I prefer no tabs in source code</i></a> by Adam Spiers</li> <li><a rel="nofollow" class="external text" href="https://web.archive.org/web/20131209200846/http://derkarl.org/why_to_tabs.html"><i>Why I love having tabs in source code</i></a> (archived)</li> <li><a rel="nofollow" class="external text" href="http://nickgravgaard.com/elastictabstops/"><i>Elastic tabstops – the solution to the tabs-versus-spaces issue</i></a></li></ul> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐5c6f46dcf‐2w9ts Cached time: 20250329215001 Cache expiry: 2592000 Reduced expiry: false Complications: [vary‐revision‐sha1, show‐toc] CPU time usage: 0.594 seconds Real time usage: 2.412 seconds Preprocessor visited node count: 3739/1000000 Post‐expand include size: 91739/2097152 bytes Template argument size: 2367/2097152 bytes Highest expansion depth: 14/100 Expensive parser function count: 42/500 Unstrip recursion depth: 1/20 Unstrip post‐expand size: 194344/5000000 bytes Lua time usage: 0.305/10.000 seconds Lua memory usage: 7540488/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 2297.672 1 -total 12.21% 280.503 1 Template:Reflist 5.00% 114.986 2 Template:Code 4.02% 92.436 26 Template:Cite_web 3.69% 84.714 1 Template:Cite_tech_report 2.83% 65.023 1 Template:Short_description 2.21% 50.806 2 Template:Ambox 1.79% 41.074 9 Template:Cite_book 1.76% 40.396 1 Template:Unreferenced_section 1.73% 39.656 2 Template:Pagetype --> <!-- Saved in parser cache with key enwiki:pcache:294545:|#|:idhash:canonical and timestamp 20250329215001 and revision id 1282552939. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?useformat=desktop&type=1x1&usesul3=0" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://en.wikipedia.org/w/index.php?title=Indentation_style&oldid=1282552939">https://en.wikipedia.org/w/index.php?title=Indentation_style&oldid=1282552939</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Help:Category" title="Help:Category">Categories</a>: <ul><li><a href="/wiki/Category:Software_wars" title="Category:Software wars">Software wars</a></li><li><a href="/wiki/Category:Text_editor_features" title="Category:Text editor features">Text editor features</a></li><li><a href="/wiki/Category:Source_code" title="Category:Source code">Source code</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="/wiki/Category:CS1_interwiki-linked_names" title="Category:CS1 interwiki-linked names">CS1 interwiki-linked names</a></li><li><a href="/wiki/Category:Articles_with_short_description" title="Category:Articles with short description">Articles with short description</a></li><li><a href="/wiki/Category:Short_description_matches_Wikidata" title="Category:Short description matches Wikidata">Short description matches Wikidata</a></li><li><a href="/wiki/Category:Use_dmy_dates_from_October_2022" title="Category:Use dmy dates from October 2022">Use dmy dates from October 2022</a></li><li><a href="/wiki/Category:All_articles_with_unsourced_statements" title="Category:All articles with unsourced statements">All articles with unsourced statements</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_October_2016" title="Category:Articles with unsourced statements from October 2016">Articles with unsourced statements from October 2016</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_February_2013" title="Category:Articles with unsourced statements from February 2013">Articles with unsourced statements from February 2013</a></li><li><a href="/wiki/Category:Articles_needing_additional_references_from_March_2024" title="Category:Articles needing additional references from March 2024">Articles needing additional references from March 2024</a></li><li><a href="/wiki/Category:All_articles_needing_additional_references" title="Category:All articles needing additional references">All articles needing additional references</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 27 March 2025, at 03:27<span class="anonymous-show"> (UTC)</span>.</li> <li id="footer-info-copyright">Text is available under the <a href="/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License" title="Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License">Creative Commons Attribution-ShareAlike 4.0 License</a>; additional terms may apply. By using this site, you agree to the <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use" class="extiw" title="foundation:Special:MyLanguage/Policy:Terms of Use">Terms of Use</a> and <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy" class="extiw" title="foundation:Special:MyLanguage/Policy:Privacy policy">Privacy Policy</a>. Wikipedia® is a registered trademark of the <a rel="nofollow" class="external text" href="https://wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, a non-profit organization.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:About">About Wikipedia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:General_disclaimer">Disclaimers</a></li> <li id="footer-places-contact"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/en.wikipedia.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//en.m.wikipedia.org/w/index.php?title=Indentation_style&mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://www.wikimedia.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><picture><source media="(min-width: 500px)" srcset="/static/images/footer/wikimedia-button.svg" width="84" height="29"><img src="/static/images/footer/wikimedia.svg" width="25" height="25" alt="Wikimedia Foundation" lang="en" loading="lazy"></picture></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><picture><source media="(min-width: 500px)" srcset="/w/resources/assets/poweredby_mediawiki.svg" width="88" height="31"><img src="/w/resources/assets/mediawiki_compact.svg" alt="Powered by MediaWiki" lang="en" width="25" height="25" loading="lazy"></picture></a></li> </ul> </footer> </div> </div> </div> <div class="vector-header-container vector-sticky-header-container"> <div id="vector-sticky-header" class="vector-sticky-header"> <div class="vector-sticky-header-start"> <div class="vector-sticky-header-icon-start vector-button-flush-left vector-button-flush-right" aria-hidden="true"> <button class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-sticky-header-search-toggle" tabindex="-1" data-event-name="ui.vector-sticky-search-form.icon"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </button> </div> <div role="search" class="vector-search-box-vue vector-search-box-show-thumbnail vector-search-box"> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail"> <form action="/w/index.php" id="vector-sticky-search-form" class="cdx-search-input cdx-search-input--has-end-button"> <div class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia"> <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <div class="vector-sticky-header-context-bar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-sticky-header-toc" class="vector-dropdown mw-portlet mw-portlet-sticky-header-toc vector-sticky-header-toc vector-button-flush-left" > <input type="checkbox" id="vector-sticky-header-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-sticky-header-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-sticky-header-toc-label" for="vector-sticky-header-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-sticky-header-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div class="vector-sticky-header-context-bar-primary" aria-hidden="true" ><span class="mw-page-title-main">Indentation style</span></div> </div> </div> <div class="vector-sticky-header-end" aria-hidden="true"> <div class="vector-sticky-header-icons"> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-talk-sticky-header" tabindex="-1" data-event-name="talk-sticky-header"><span class="vector-icon mw-ui-icon-speechBubbles mw-ui-icon-wikimedia-speechBubbles"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-subject-sticky-header" tabindex="-1" data-event-name="subject-sticky-header"><span class="vector-icon mw-ui-icon-article mw-ui-icon-wikimedia-article"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-history-sticky-header" tabindex="-1" data-event-name="history-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-history mw-ui-icon-wikimedia-wikimedia-history"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only mw-watchlink" id="ca-watchstar-sticky-header" tabindex="-1" data-event-name="watch-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-star mw-ui-icon-wikimedia-wikimedia-star"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-edit-sticky-header" tabindex="-1" data-event-name="wikitext-edit-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-wikiText mw-ui-icon-wikimedia-wikimedia-wikiText"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-ve-edit-sticky-header" tabindex="-1" data-event-name="ve-edit-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-edit mw-ui-icon-wikimedia-wikimedia-edit"></span> <span></span> </a> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only" id="ca-viewsource-sticky-header" tabindex="-1" data-event-name="ve-edit-protected-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-editLock mw-ui-icon-wikimedia-wikimedia-editLock"></span> <span></span> </a> </div> <div class="vector-sticky-header-buttons"> <button class="cdx-button cdx-button--weight-quiet mw-interlanguage-selector" id="p-lang-btn-sticky-header" tabindex="-1" data-event-name="ui.dropdown-p-lang-btn-sticky-header"><span class="vector-icon mw-ui-icon-wikimedia-language mw-ui-icon-wikimedia-wikimedia-language"></span> <span>16 languages</span> </button> <a href="#" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive" id="ca-addsection-sticky-header" tabindex="-1" data-event-name="addsection-sticky-header"><span class="vector-icon mw-ui-icon-speechBubbleAdd-progressive mw-ui-icon-wikimedia-speechBubbleAdd-progressive"></span> <span>Add topic</span> </a> </div> <div class="vector-sticky-header-icon-end"> <div class="vector-user-links"> </div> </div> </div> </div> </div> <div class="mw-portlet mw-portlet-dock-bottom emptyPortlet" id="p-dock-bottom"> <ul> </ul> </div> <script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-5c6f46dcf-lzcg8","wgBackendResponseTime":226,"wgPageParseReport":{"limitreport":{"cputime":"0.594","walltime":"2.412","ppvisitednodes":{"value":3739,"limit":1000000},"postexpandincludesize":{"value":91739,"limit":2097152},"templateargumentsize":{"value":2367,"limit":2097152},"expansiondepth":{"value":14,"limit":100},"expensivefunctioncount":{"value":42,"limit":500},"unstrip-depth":{"value":1,"limit":20},"unstrip-size":{"value":194344,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 2297.672 1 -total"," 12.21% 280.503 1 Template:Reflist"," 5.00% 114.986 2 Template:Code"," 4.02% 92.436 26 Template:Cite_web"," 3.69% 84.714 1 Template:Cite_tech_report"," 2.83% 65.023 1 Template:Short_description"," 2.21% 50.806 2 Template:Ambox"," 1.79% 41.074 9 Template:Cite_book"," 1.76% 40.396 1 Template:Unreferenced_section"," 1.73% 39.656 2 Template:Pagetype"]},"scribunto":{"limitreport-timeusage":{"value":"0.305","limit":"10.000"},"limitreport-memusage":{"value":7540488,"limit":52428800}},"cachereport":{"origin":"mw-web.codfw.main-5c6f46dcf-2w9ts","timestamp":"20250329215001","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Indentation style","url":"https:\/\/en.wikipedia.org\/wiki\/Indentation_style","sameAs":"http:\/\/www.wikidata.org\/entity\/Q13444128","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q13444128","author":{"@type":"Organization","name":"Contributors to Wikimedia projects"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2003-08-12T05:16:39Z","dateModified":"2025-03-27T03:27:20Z","headline":"computer programming convention"}</script> </body> </html>