CINXE.COM
Template:For loop - Wikipedia
<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-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-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Template:For loop - Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-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-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":"30bb16ae-662a-4b70-a34a-02fd4fbee15d","wgCanonicalNamespace":"Template","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":10,"wgPageName":"Template:For_loop","wgTitle":"For loop","wgCurRevisionId":851685775,"wgRevisionId":851685775,"wgArticleId":44481616,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Wikipedia template-protected templates","Lua-based templates","Repetition templates"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Template:For_loop","wgRelevantArticleId":44481616,"wgIsProbablyEditable":false,"wgRelevantPageIsProbablyEditable":false,"wgRestrictionEdit":["templateeditor"],"wgRestrictionMove":["templateeditor"],"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":200,"wgRelatedArticlesCompat":[],"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q10966397","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGEStructuredTaskRejectionReasonTextInputEnabled":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.pygments":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","jquery.tablesorter.styles":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["ext.pygments.view","site","mediawiki.page.ready","jquery.tablesorter","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", "wikibase.client.vector-2022","ext.checkUser.clientHints","wikibase.sidebar.tracking"];</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.pygments%2CwikimediaBadges%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cjquery.tablesorter.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.5"> <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="Template:For loop - 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/Template:For_loop"> <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/Template:For_loop"> <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-10 ns-subject page-Template_For_loop rootpage-Template_For_loop 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" > <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> </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/wiki/Special:FundraiserRedirector?utm_source=donate&utm_medium=sidebar&utm_campaign=C13_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=Template%3AFor+loop" 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=Template%3AFor+loop" 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/wiki/Special:FundraiserRedirector?utm_source=donate&utm_medium=sidebar&utm_campaign=C13_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=Template%3AFor+loop" 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=Template%3AFor+loop" 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-Usage" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Usage"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Usage</span> </div> </a> <button aria-controls="toc-Usage-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 Usage subsection</span> </button> <ul id="toc-Usage-sublist" class="vector-toc-list"> <li id="toc-Caution" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Caution"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.1</span> <span>Caution</span> </div> </a> <ul id="toc-Caution-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Substitution" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Substitution"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2</span> <span>Substitution</span> </div> </a> <ul id="toc-Substitution-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Examples" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Examples"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Examples</span> </div> </a> <button aria-controls="toc-Examples-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 Examples subsection</span> </button> <ul id="toc-Examples-sublist" class="vector-toc-list"> <li id="toc-Other_examples_with_explicit_values" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Other_examples_with_explicit_values"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.1</span> <span>Other examples with explicit values</span> </div> </a> <ul id="toc-Other_examples_with_explicit_values-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Notes_about_legacy_code" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Notes_about_legacy_code"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Notes about legacy code</span> </div> </a> <ul id="toc-Notes_about_legacy_code-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </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" > <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-namespace">Template</span><span class="mw-page-title-separator">:</span><span class="mw-page-title-main">For loop</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 86 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-86" 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">86 languages</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-af mw-list-item"><a href="https://af.wikipedia.org/wiki/Sjabloon:For_loop" title="Sjabloon:For loop – Afrikaans" lang="af" hreflang="af" data-title="Sjabloon:For loop" data-language-autonym="Afrikaans" data-language-local-name="Afrikaans" class="interlanguage-link-target"><span>Afrikaans</span></a></li><li class="interlanguage-link interwiki-ab mw-list-item"><a href="https://ab.wikipedia.org/wiki/%D0%90%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD:For_loop" title="Ашаблон:For loop – Abkhazian" lang="ab" hreflang="ab" data-title="Ашаблон:For loop" data-language-autonym="Аԥсшәа" data-language-local-name="Abkhazian" class="interlanguage-link-target"><span>Аԥсшәа</span></a></li><li class="interlanguage-link interwiki-ar mw-list-item"><a href="https://ar.wikipedia.org/wiki/%D9%82%D8%A7%D9%84%D8%A8:For_loop" title="قالب:For loop – Arabic" lang="ar" hreflang="ar" data-title="قالب:For loop" data-language-autonym="العربية" data-language-local-name="Arabic" class="interlanguage-link-target"><span>العربية</span></a></li><li class="interlanguage-link interwiki-as mw-list-item"><a href="https://as.wikipedia.org/wiki/%E0%A6%B8%E0%A6%BE%E0%A6%81%E0%A6%9A:For_loop" title="সাঁচ:For loop – Assamese" lang="as" hreflang="as" data-title="সাঁচ:For loop" data-language-autonym="অসমীয়া" data-language-local-name="Assamese" class="interlanguage-link-target"><span>অসমীয়া</span></a></li><li class="interlanguage-link interwiki-az mw-list-item"><a href="https://az.wikipedia.org/wiki/%C5%9Eablon:For_loop" title="Şablon:For loop – Azerbaijani" lang="az" hreflang="az" data-title="Şablon:For loop" data-language-autonym="Azərbaycanca" data-language-local-name="Azerbaijani" class="interlanguage-link-target"><span>Azərbaycanca</span></a></li><li class="interlanguage-link interwiki-azb mw-list-item"><a href="https://azb.wikipedia.org/wiki/%D8%B4%D8%A7%D8%A8%D9%84%D9%88%D9%86:For_loop" title="شابلون:For loop – South Azerbaijani" lang="azb" hreflang="azb" data-title="شابلون:For loop" data-language-autonym="تۆرکجه" data-language-local-name="South Azerbaijani" class="interlanguage-link-target"><span>تۆرکجه</span></a></li><li class="interlanguage-link interwiki-ban mw-list-item"><a href="https://ban.wikipedia.org/wiki/Mal:For_loop" title="Mal:For loop – Balinese" lang="ban" hreflang="ban" data-title="Mal:For loop" data-language-autonym="Basa Bali" data-language-local-name="Balinese" class="interlanguage-link-target"><span>Basa Bali</span></a></li><li class="interlanguage-link interwiki-bn mw-list-item"><a href="https://bn.wikipedia.org/wiki/%E0%A6%9F%E0%A7%87%E0%A6%AE%E0%A6%AA%E0%A7%8D%E0%A6%B2%E0%A7%87%E0%A6%9F:For_loop" title="টেমপ্লেট:For loop – Bangla" lang="bn" hreflang="bn" data-title="টেমপ্লেট:For loop" data-language-autonym="বাংলা" data-language-local-name="Bangla" class="interlanguage-link-target"><span>বাংলা</span></a></li><li class="interlanguage-link interwiki-zh-min-nan mw-list-item"><a href="https://zh-min-nan.wikipedia.org/wiki/Pang-b%C3%B4%CD%98:For_loop" title="Pang-bô͘:For loop – Minnan" lang="nan" hreflang="nan" data-title="Pang-bô͘:For loop" data-language-autonym="閩南語 / Bân-lâm-gú" data-language-local-name="Minnan" class="interlanguage-link-target"><span>閩南語 / Bân-lâm-gú</span></a></li><li class="interlanguage-link interwiki-ba mw-list-item"><a href="https://ba.wikipedia.org/wiki/%D2%A0%D0%B0%D0%BB%D1%8B%D0%BF:For_loop" title="Ҡалып:For loop – Bashkir" lang="ba" hreflang="ba" data-title="Ҡалып:For loop" data-language-autonym="Башҡортса" data-language-local-name="Bashkir" class="interlanguage-link-target"><span>Башҡортса</span></a></li><li class="interlanguage-link interwiki-be-x-old mw-list-item"><a href="https://be-tarask.wikipedia.org/wiki/%D0%A8%D0%B0%D0%B1%D0%BB%D1%91%D0%BD:%D0%A6%D1%8B%D0%BA%D0%BB%D1%8C_%E2%80%9E%D0%B4%D0%BB%D1%8F%E2%80%9C" title="Шаблён:Цыкль „для“ – Belarusian (Taraškievica orthography)" lang="be-tarask" hreflang="be-tarask" data-title="Шаблён:Цыкль „для“" data-language-autonym="Беларуская (тарашкевіца)" data-language-local-name="Belarusian (Taraškievica orthography)" class="interlanguage-link-target"><span>Беларуская (тарашкевіца)</span></a></li><li class="interlanguage-link interwiki-bs mw-list-item"><a href="https://bs.wikipedia.org/wiki/%C5%A0ablon:For_loop" title="Šablon:For loop – Bosnian" lang="bs" hreflang="bs" data-title="Šablon:For loop" data-language-autonym="Bosanski" data-language-local-name="Bosnian" class="interlanguage-link-target"><span>Bosanski</span></a></li><li class="interlanguage-link interwiki-bxr mw-list-item"><a href="https://bxr.wikipedia.org/wiki/%D0%97%D0%B0%D0%B3%D0%B1%D0%B0%D1%80:For_loop" title="Загбар:For loop – Russia Buriat" lang="bxr" hreflang="bxr" data-title="Загбар:For loop" data-language-autonym="Буряад" data-language-local-name="Russia Buriat" class="interlanguage-link-target"><span>Буряад</span></a></li><li class="interlanguage-link interwiki-ca mw-list-item"><a href="https://ca.wikipedia.org/wiki/Plantilla:For_loop" title="Plantilla:For loop – Catalan" lang="ca" hreflang="ca" data-title="Plantilla:For loop" data-language-autonym="Català" data-language-local-name="Catalan" class="interlanguage-link-target"><span>Català</span></a></li><li class="interlanguage-link interwiki-ceb mw-list-item"><a href="https://ceb.wikipedia.org/wiki/Plantilya:For_loop" title="Plantilya:For loop – Cebuano" lang="ceb" hreflang="ceb" data-title="Plantilya:For loop" data-language-autonym="Cebuano" data-language-local-name="Cebuano" class="interlanguage-link-target"><span>Cebuano</span></a></li><li class="interlanguage-link interwiki-co mw-list-item"><a href="https://co.wikipedia.org/wiki/Template:For_loop" title="Template:For loop – Corsican" lang="co" hreflang="co" data-title="Template:For loop" data-language-autonym="Corsu" data-language-local-name="Corsican" class="interlanguage-link-target"><span>Corsu</span></a></li><li class="interlanguage-link interwiki-cy mw-list-item"><a href="https://cy.wikipedia.org/wiki/Nodyn:For_loop" title="Nodyn:For loop – Welsh" lang="cy" hreflang="cy" data-title="Nodyn:For loop" data-language-autonym="Cymraeg" data-language-local-name="Welsh" class="interlanguage-link-target"><span>Cymraeg</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Vorlage:Grafische_Zeitleiste/For_loop" title="Vorlage:Grafische Zeitleiste/For loop – German" lang="de" hreflang="de" data-title="Vorlage:Grafische Zeitleiste/For loop" data-language-autonym="Deutsch" data-language-local-name="German" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-dsb mw-list-item"><a href="https://dsb.wikipedia.org/wiki/P%C5%9Bed%C5%82oga:For" title="Pśedłoga:For – Lower Sorbian" lang="dsb" hreflang="dsb" data-title="Pśedłoga:For" data-language-autonym="Dolnoserbski" data-language-local-name="Lower Sorbian" class="interlanguage-link-target"><span>Dolnoserbski</span></a></li><li class="interlanguage-link interwiki-et mw-list-item"><a href="https://et.wikipedia.org/wiki/Mall:For_loop" title="Mall:For loop – Estonian" lang="et" hreflang="et" data-title="Mall:For loop" data-language-autonym="Eesti" data-language-local-name="Estonian" class="interlanguage-link-target"><span>Eesti</span></a></li><li class="interlanguage-link interwiki-el mw-list-item"><a href="https://el.wikipedia.org/wiki/%CE%A0%CF%81%CF%8C%CF%84%CF%85%CF%80%CE%BF:For_loop" title="Πρότυπο:For loop – Greek" lang="el" hreflang="el" data-title="Πρότυπο:For loop" data-language-autonym="Ελληνικά" data-language-local-name="Greek" class="interlanguage-link-target"><span>Ελληνικά</span></a></li><li class="interlanguage-link interwiki-es mw-list-item"><a href="https://es.wikipedia.org/wiki/Plantilla:Bucle_for" title="Plantilla:Bucle for – Spanish" lang="es" hreflang="es" data-title="Plantilla:Bucle for" 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-eo mw-list-item"><a href="https://eo.wikipedia.org/wiki/%C5%9Cablono:Iteraci" title="Ŝablono:Iteraci – Esperanto" lang="eo" hreflang="eo" data-title="Ŝablono:Iteraci" data-language-autonym="Esperanto" data-language-local-name="Esperanto" class="interlanguage-link-target"><span>Esperanto</span></a></li><li class="interlanguage-link interwiki-fa mw-list-item"><a href="https://fa.wikipedia.org/wiki/%D8%A7%D9%84%DA%AF%D9%88:For_loop" title="الگو:For loop – Persian" lang="fa" hreflang="fa" data-title="الگو:For loop" 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/Mod%C3%A8le:For_loop" title="Modèle:For loop – French" lang="fr" hreflang="fr" data-title="Modèle:For loop" 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-gl mw-list-item"><a href="https://gl.wikipedia.org/wiki/Modelo:BucleFor" title="Modelo:BucleFor – Galician" lang="gl" hreflang="gl" data-title="Modelo:BucleFor" data-language-autonym="Galego" data-language-local-name="Galician" class="interlanguage-link-target"><span>Galego</span></a></li><li class="interlanguage-link interwiki-gu mw-list-item"><a href="https://gu.wikipedia.org/wiki/%E0%AA%B5%E0%AA%BF%E0%AA%AD%E0%AA%BE%E0%AA%97:For_loop" title="વિભાગ:For loop – Gujarati" lang="gu" hreflang="gu" data-title="વિભાગ:For loop" data-language-autonym="ગુજરાતી" data-language-local-name="Gujarati" class="interlanguage-link-target"><span>ગુજરાતી</span></a></li><li class="interlanguage-link interwiki-guw mw-list-item"><a href="https://guw.wikipedia.org/wiki/Ohia:For_loop" title="Ohia:For loop – Gun" lang="guw" hreflang="guw" data-title="Ohia:For loop" data-language-autonym="Gungbe" data-language-local-name="Gun" class="interlanguage-link-target"><span>Gungbe</span></a></li><li class="interlanguage-link interwiki-hak mw-list-item"><a href="https://hak.wikipedia.org/wiki/%E6%A8%A1%E6%9D%BF:For_loop" title="模板:For loop – Hakka Chinese" lang="hak" hreflang="hak" data-title="模板:For loop" data-language-autonym="客家語 / Hak-kâ-ngî" data-language-local-name="Hakka Chinese" class="interlanguage-link-target"><span>客家語 / Hak-kâ-ngî</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%ED%8B%80:For_%EC%88%9C%ED%99%98" title="틀:For 순환 – Korean" lang="ko" hreflang="ko" data-title="틀:For 순환" data-language-autonym="한국어" data-language-local-name="Korean" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-hy mw-list-item"><a href="https://hy.wikipedia.org/wiki/%D4%BF%D5%A1%D5%B2%D5%A1%D5%BA%D5%A1%D6%80:For_loop" title="Կաղապար:For loop – Armenian" lang="hy" hreflang="hy" data-title="Կաղապար:For loop" data-language-autonym="Հայերեն" data-language-local-name="Armenian" class="interlanguage-link-target"><span>Հայերեն</span></a></li><li class="interlanguage-link interwiki-hi mw-list-item"><a href="https://hi.wikipedia.org/wiki/%E0%A4%B8%E0%A4%BE%E0%A4%81%E0%A4%9A%E0%A4%BE:For_loop" title="साँचा:For loop – Hindi" lang="hi" hreflang="hi" data-title="साँचा:For loop" data-language-autonym="हिन्दी" data-language-local-name="Hindi" class="interlanguage-link-target"><span>हिन्दी</span></a></li><li class="interlanguage-link interwiki-hsb mw-list-item"><a href="https://hsb.wikipedia.org/wiki/P%C5%99ed%C5%82oha:For" title="Předłoha:For – Upper Sorbian" lang="hsb" hreflang="hsb" data-title="Předłoha:For" data-language-autonym="Hornjoserbsce" data-language-local-name="Upper Sorbian" class="interlanguage-link-target"><span>Hornjoserbsce</span></a></li><li class="interlanguage-link interwiki-ilo mw-list-item"><a href="https://ilo.wikipedia.org/wiki/Plantilia:For_loop" title="Plantilia:For loop – Iloko" lang="ilo" hreflang="ilo" data-title="Plantilia:For loop" data-language-autonym="Ilokano" data-language-local-name="Iloko" class="interlanguage-link-target"><span>Ilokano</span></a></li><li class="interlanguage-link interwiki-id mw-list-item"><a href="https://id.wikipedia.org/wiki/Templat:For_loop" title="Templat:For loop – Indonesian" lang="id" hreflang="id" data-title="Templat:For loop" data-language-autonym="Bahasa Indonesia" data-language-local-name="Indonesian" class="interlanguage-link-target"><span>Bahasa Indonesia</span></a></li><li class="interlanguage-link interwiki-is mw-list-item"><a href="https://is.wikipedia.org/wiki/Sni%C3%B0:For_loop" title="Snið:For loop – Icelandic" lang="is" hreflang="is" data-title="Snið:For loop" data-language-autonym="Íslenska" data-language-local-name="Icelandic" class="interlanguage-link-target"><span>Íslenska</span></a></li><li class="interlanguage-link interwiki-it mw-list-item"><a href="https://it.wikipedia.org/wiki/Template:Ciclo_formattato" title="Template:Ciclo formattato – Italian" lang="it" hreflang="it" data-title="Template:Ciclo formattato" data-language-autonym="Italiano" data-language-local-name="Italian" class="interlanguage-link-target"><span>Italiano</span></a></li><li class="interlanguage-link interwiki-jv mw-list-item"><a href="https://jv.wikipedia.org/wiki/Cithakan:For_loop" title="Cithakan:For loop – Javanese" lang="jv" hreflang="jv" data-title="Cithakan:For loop" data-language-autonym="Jawa" data-language-local-name="Javanese" class="interlanguage-link-target"><span>Jawa</span></a></li><li class="interlanguage-link interwiki-ka mw-list-item"><a href="https://ka.wikipedia.org/wiki/%E1%83%97%E1%83%90%E1%83%A0%E1%83%92%E1%83%98:For_loop" title="თარგი:For loop – Georgian" lang="ka" hreflang="ka" data-title="თარგი:For loop" data-language-autonym="ქართული" data-language-local-name="Georgian" class="interlanguage-link-target"><span>ქართული</span></a></li><li class="interlanguage-link interwiki-ku mw-list-item"><a href="https://ku.wikipedia.org/wiki/%C5%9Eablon:For_loop" title="Şablon:For loop – Kurdish" lang="ku" hreflang="ku" data-title="Şablon:For loop" data-language-autonym="Kurdî" data-language-local-name="Kurdish" class="interlanguage-link-target"><span>Kurdî</span></a></li><li class="interlanguage-link interwiki-lld mw-list-item"><a href="https://lld.wikipedia.org/wiki/Template:For_loop" title="Template:For loop – Ladin" lang="lld" hreflang="lld" data-title="Template:For loop" data-language-autonym="Ladin" data-language-local-name="Ladin" class="interlanguage-link-target"><span>Ladin</span></a></li><li class="interlanguage-link interwiki-lv mw-list-item"><a href="https://lv.wikipedia.org/wiki/Veidne:For_loop" title="Veidne:For loop – Latvian" lang="lv" hreflang="lv" data-title="Veidne:For loop" data-language-autonym="Latviešu" data-language-local-name="Latvian" class="interlanguage-link-target"><span>Latviešu</span></a></li><li class="interlanguage-link interwiki-lt mw-list-item"><a href="https://lt.wikipedia.org/wiki/%C5%A0ablonas:For_loop" title="Šablonas:For loop – Lithuanian" lang="lt" hreflang="lt" data-title="Šablonas:For loop" data-language-autonym="Lietuvių" data-language-local-name="Lithuanian" class="interlanguage-link-target"><span>Lietuvių</span></a></li><li class="interlanguage-link interwiki-lij mw-list-item"><a href="https://lij.wikipedia.org/wiki/Template:Ciclo_formattato" title="Template:Ciclo formattato – Ligurian" lang="lij" hreflang="lij" data-title="Template:Ciclo formattato" data-language-autonym="Ligure" data-language-local-name="Ligurian" class="interlanguage-link-target"><span>Ligure</span></a></li><li class="interlanguage-link interwiki-hu mw-list-item"><a href="https://hu.wikipedia.org/wiki/Sablon:For_loop" title="Sablon:For loop – Hungarian" lang="hu" hreflang="hu" data-title="Sablon:For loop" data-language-autonym="Magyar" data-language-local-name="Hungarian" class="interlanguage-link-target"><span>Magyar</span></a></li><li class="interlanguage-link interwiki-mk mw-list-item"><a href="https://mk.wikipedia.org/wiki/%D0%9F%D1%80%D0%B5%D0%B4%D0%BB%D0%BE%D1%88%D0%BA%D0%B0:%D0%97%D0%B0-%D1%98%D0%B0%D0%BC%D0%BA%D0%B0" title="Предлошка:За-јамка – Macedonian" lang="mk" hreflang="mk" data-title="Предлошка:За-јамка" data-language-autonym="Македонски" data-language-local-name="Macedonian" class="interlanguage-link-target"><span>Македонски</span></a></li><li class="interlanguage-link interwiki-ml mw-list-item"><a href="https://ml.wikipedia.org/wiki/%E0%B4%AB%E0%B4%B2%E0%B4%95%E0%B4%82:For_loop" title="ഫലകം:For loop – Malayalam" lang="ml" hreflang="ml" data-title="ഫലകം:For loop" data-language-autonym="മലയാളം" data-language-local-name="Malayalam" class="interlanguage-link-target"><span>മലയാളം</span></a></li><li class="interlanguage-link interwiki-ms mw-list-item"><a href="https://ms.wikipedia.org/wiki/Templat:For_loop" title="Templat:For loop – Malay" lang="ms" hreflang="ms" data-title="Templat:For loop" data-language-autonym="Bahasa Melayu" data-language-local-name="Malay" class="interlanguage-link-target"><span>Bahasa Melayu</span></a></li><li class="interlanguage-link interwiki-cdo mw-list-item"><a href="https://cdo.wikipedia.org/wiki/%E6%A8%A1%E6%9D%BF:For_loop" title="模板:For loop – Mindong" lang="cdo" hreflang="cdo" data-title="模板:For loop" data-language-autonym="閩東語 / Mìng-dĕ̤ng-ngṳ̄" data-language-local-name="Mindong" class="interlanguage-link-target"><span>閩東語 / Mìng-dĕ̤ng-ngṳ̄</span></a></li><li class="interlanguage-link interwiki-nl mw-list-item"><a href="https://nl.wikipedia.org/wiki/Sjabloon:For_loop" title="Sjabloon:For loop – Dutch" lang="nl" hreflang="nl" data-title="Sjabloon:For loop" data-language-autonym="Nederlands" data-language-local-name="Dutch" class="interlanguage-link-target"><span>Nederlands</span></a></li><li class="interlanguage-link interwiki-ne mw-list-item"><a href="https://ne.wikipedia.org/wiki/%E0%A4%A2%E0%A4%BE%E0%A4%81%E0%A4%9A%E0%A4%BE:For_loop" title="ढाँचा:For loop – Nepali" lang="ne" hreflang="ne" data-title="ढाँचा:For loop" data-language-autonym="नेपाली" data-language-local-name="Nepali" class="interlanguage-link-target"><span>नेपाली</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/Template:For_loop" title="Template:For loop – Japanese" lang="ja" hreflang="ja" data-title="Template:For loop" data-language-autonym="日本語" data-language-local-name="Japanese" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-ce mw-list-item"><a href="https://ce.wikipedia.org/wiki/%D0%9A%D0%B5%D0%BF:For" title="Кеп:For – Chechen" lang="ce" hreflang="ce" data-title="Кеп:For" data-language-autonym="Нохчийн" data-language-local-name="Chechen" class="interlanguage-link-target"><span>Нохчийн</span></a></li><li class="interlanguage-link interwiki-or mw-list-item"><a href="https://or.wikipedia.org/wiki/%E0%AC%9B%E0%AC%BE%E0%AC%9E%E0%AD%8D%E0%AC%9A:For_loop" title="ଛାଞ୍ଚ:For loop – Odia" lang="or" hreflang="or" data-title="ଛାଞ୍ଚ:For loop" data-language-autonym="ଓଡ଼ିଆ" data-language-local-name="Odia" class="interlanguage-link-target"><span>ଓଡ଼ିଆ</span></a></li><li class="interlanguage-link interwiki-uz mw-list-item"><a href="https://uz.wikipedia.org/wiki/Andoza:For_loop" title="Andoza:For loop – Uzbek" lang="uz" hreflang="uz" data-title="Andoza:For loop" data-language-autonym="Oʻzbekcha / ўзбекча" data-language-local-name="Uzbek" class="interlanguage-link-target"><span>Oʻzbekcha / ўзбекча</span></a></li><li class="interlanguage-link interwiki-ps mw-list-item"><a href="https://ps.wikipedia.org/wiki/%DA%A9%D9%8A%D9%86%DA%89%DB%8D:For_loop" title="کينډۍ:For loop – Pashto" lang="ps" hreflang="ps" data-title="کينډۍ:For loop" data-language-autonym="پښتو" data-language-local-name="Pashto" class="interlanguage-link-target"><span>پښتو</span></a></li><li class="interlanguage-link interwiki-pl mw-list-item"><a href="https://pl.wikipedia.org/wiki/Szablon:For_loop" title="Szablon:For loop – Polish" lang="pl" hreflang="pl" data-title="Szablon:For loop" data-language-autonym="Polski" data-language-local-name="Polish" class="interlanguage-link-target"><span>Polski</span></a></li><li class="interlanguage-link interwiki-pt mw-list-item"><a href="https://pt.wikipedia.org/wiki/Predefini%C3%A7%C3%A3o:For_loop" title="Predefinição:For loop – Portuguese" lang="pt" hreflang="pt" data-title="Predefinição:For loop" 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-ro mw-list-item"><a href="https://ro.wikipedia.org/wiki/Format:For_loop" title="Format:For loop – Romanian" lang="ro" hreflang="ro" data-title="Format:For loop" data-language-autonym="Română" data-language-local-name="Romanian" class="interlanguage-link-target"><span>Română</span></a></li><li class="interlanguage-link interwiki-rue mw-list-item"><a href="https://rue.wikipedia.org/wiki/%D0%A8%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD%D0%B0:For_loop" title="Шаблона:For loop – Rusyn" lang="rue" hreflang="rue" data-title="Шаблона:For loop" data-language-autonym="Русиньскый" data-language-local-name="Rusyn" class="interlanguage-link-target"><span>Русиньскый</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/%D0%A8%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD:For_loop" title="Шаблон:For loop – Russian" lang="ru" hreflang="ru" data-title="Шаблон:For loop" data-language-autonym="Русский" data-language-local-name="Russian" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-sah mw-list-item"><a href="https://sah.wikipedia.org/wiki/%D0%A5%D0%B0%D0%BB%D1%8B%D1%8B%D0%BF:For_loop" title="Халыып:For loop – Yakut" lang="sah" hreflang="sah" data-title="Халыып:For loop" data-language-autonym="Саха тыла" data-language-local-name="Yakut" class="interlanguage-link-target"><span>Саха тыла</span></a></li><li class="interlanguage-link interwiki-sco mw-list-item"><a href="https://sco.wikipedia.org/wiki/Template:For_loop" title="Template:For loop – Scots" lang="sco" hreflang="sco" data-title="Template:For loop" data-language-autonym="Scots" data-language-local-name="Scots" class="interlanguage-link-target"><span>Scots</span></a></li><li class="interlanguage-link interwiki-si mw-list-item"><a href="https://si.wikipedia.org/wiki/%E0%B7%83%E0%B7%90%E0%B6%9A%E0%B7%92%E0%B6%BD%E0%B7%8A%E0%B6%BD:For_loop" title="සැකිල්ල:For loop – Sinhala" lang="si" hreflang="si" data-title="සැකිල්ල:For loop" data-language-autonym="සිංහල" data-language-local-name="Sinhala" class="interlanguage-link-target"><span>සිංහල</span></a></li><li class="interlanguage-link interwiki-simple mw-list-item"><a href="https://simple.wikipedia.org/wiki/Template:For_loop" title="Template:For loop – Simple English" lang="en-simple" hreflang="en-simple" data-title="Template:For loop" data-language-autonym="Simple English" data-language-local-name="Simple English" class="interlanguage-link-target"><span>Simple English</span></a></li><li class="interlanguage-link interwiki-sd mw-list-item"><a href="https://sd.wikipedia.org/wiki/%D8%B3%D8%A7%D9%86%DA%86%D9%88:For_loop" title="سانچو:For loop – Sindhi" lang="sd" hreflang="sd" data-title="سانچو:For loop" data-language-autonym="سنڌي" data-language-local-name="Sindhi" class="interlanguage-link-target"><span>سنڌي</span></a></li><li class="interlanguage-link interwiki-sk mw-list-item"><a href="https://sk.wikipedia.org/wiki/%C5%A0abl%C3%B3na:For" title="Šablóna:For – Slovak" lang="sk" hreflang="sk" data-title="Šablóna:For" data-language-autonym="Slovenčina" data-language-local-name="Slovak" class="interlanguage-link-target"><span>Slovenčina</span></a></li><li class="interlanguage-link interwiki-sl mw-list-item"><a href="https://sl.wikipedia.org/wiki/Predloga:For3" title="Predloga:For3 – Slovenian" lang="sl" hreflang="sl" data-title="Predloga:For3" data-language-autonym="Slovenščina" data-language-local-name="Slovenian" class="interlanguage-link-target"><span>Slovenščina</span></a></li><li class="interlanguage-link interwiki-ckb mw-list-item"><a href="https://ckb.wikipedia.org/wiki/%D8%AF%D8%A7%DA%95%DB%8E%DA%98%DB%95:For_loop" title="داڕێژە:For loop – Central Kurdish" lang="ckb" hreflang="ckb" data-title="داڕێژە:For loop" data-language-autonym="کوردی" data-language-local-name="Central Kurdish" class="interlanguage-link-target"><span>کوردی</span></a></li><li class="interlanguage-link interwiki-sr mw-list-item"><a href="https://sr.wikipedia.org/wiki/%D0%A8%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD:For_loop" title="Шаблон:For loop – Serbian" lang="sr" hreflang="sr" data-title="Шаблон:For loop" data-language-autonym="Српски / srpski" data-language-local-name="Serbian" class="interlanguage-link-target"><span>Српски / srpski</span></a></li><li class="interlanguage-link interwiki-fi mw-list-item"><a href="https://fi.wikipedia.org/wiki/Malline:For" title="Malline:For – Finnish" lang="fi" hreflang="fi" data-title="Malline:For" data-language-autonym="Suomi" data-language-local-name="Finnish" class="interlanguage-link-target"><span>Suomi</span></a></li><li class="interlanguage-link interwiki-tl mw-list-item"><a href="https://tl.wikipedia.org/wiki/Padron:For_loop" title="Padron:For loop – Tagalog" lang="tl" hreflang="tl" data-title="Padron:For loop" data-language-autonym="Tagalog" data-language-local-name="Tagalog" class="interlanguage-link-target"><span>Tagalog</span></a></li><li class="interlanguage-link interwiki-ta mw-list-item"><a href="https://ta.wikipedia.org/wiki/%E0%AE%B5%E0%AE%BE%E0%AE%B0%E0%AF%8D%E0%AE%AA%E0%AF%8D%E0%AE%AA%E0%AF%81%E0%AE%B0%E0%AF%81:For_loop" title="வார்ப்புரு:For loop – Tamil" lang="ta" hreflang="ta" data-title="வார்ப்புரு:For loop" data-language-autonym="தமிழ்" data-language-local-name="Tamil" class="interlanguage-link-target"><span>தமிழ்</span></a></li><li class="interlanguage-link interwiki-shn mw-list-item"><a href="https://shn.wikipedia.org/wiki/%E1%80%91%E1%82%85%E1%80%99%E1%80%BA%E1%80%B8%E1%80%95%E1%80%9C%E1%80%B5%E1%80%90%E1%80%BA%E1%82%89:For_loop" title="ထႅမ်းပလဵတ်ႉ:For loop – Shan" lang="shn" hreflang="shn" data-title="ထႅမ်းပလဵတ်ႉ:For loop" data-language-autonym="ၽႃႇသႃႇတႆး " data-language-local-name="Shan" class="interlanguage-link-target"><span>ၽႃႇသႃႇတႆး </span></a></li><li class="interlanguage-link interwiki-th mw-list-item"><a href="https://th.wikipedia.org/wiki/%E0%B9%81%E0%B8%A1%E0%B9%88%E0%B9%81%E0%B8%9A%E0%B8%9A:For_loop" title="แม่แบบ:For loop – Thai" lang="th" hreflang="th" data-title="แม่แบบ:For loop" data-language-autonym="ไทย" data-language-local-name="Thai" class="interlanguage-link-target"><span>ไทย</span></a></li><li class="interlanguage-link interwiki-tr mw-list-item"><a href="https://tr.wikipedia.org/wiki/%C5%9Eablon:For_loop" title="Şablon:For loop – Turkish" lang="tr" hreflang="tr" data-title="Şablon:For loop" data-language-autonym="Türkçe" data-language-local-name="Turkish" class="interlanguage-link-target"><span>Türkçe</span></a></li><li class="interlanguage-link interwiki-uk mw-list-item"><a href="https://uk.wikipedia.org/wiki/%D0%A8%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD:For_loop" title="Шаблон:For loop – Ukrainian" lang="uk" hreflang="uk" data-title="Шаблон:For loop" 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%B3%D8%A7%D9%86%DA%86%DB%81:For_loop" title="سانچہ:For loop – Urdu" lang="ur" hreflang="ur" data-title="سانچہ:For loop" data-language-autonym="اردو" data-language-local-name="Urdu" class="interlanguage-link-target"><span>اردو</span></a></li><li class="interlanguage-link interwiki-vec mw-list-item"><a href="https://vec.wikipedia.org/wiki/Mode%C5%82o:Ciclo_formattato" title="Modeło:Ciclo formattato – Venetian" lang="vec" hreflang="vec" data-title="Modeło:Ciclo formattato" data-language-autonym="Vèneto" data-language-local-name="Venetian" class="interlanguage-link-target"><span>Vèneto</span></a></li><li class="interlanguage-link interwiki-vi mw-list-item"><a href="https://vi.wikipedia.org/wiki/B%E1%BA%A3n_m%E1%BA%ABu:V%C3%B2ng_l%E1%BA%B7p_for" title="Bản mẫu:Vòng lặp for – Vietnamese" lang="vi" hreflang="vi" data-title="Bản mẫu:Vòng lặp for" data-language-autonym="Tiếng Việt" data-language-local-name="Vietnamese" class="interlanguage-link-target"><span>Tiếng Việt</span></a></li><li class="interlanguage-link interwiki-wa mw-list-item"><a href="https://wa.wikipedia.org/wiki/Modele:For_loop" title="Modele:For loop – Walloon" lang="wa" hreflang="wa" data-title="Modele:For loop" data-language-autonym="Walon" data-language-local-name="Walloon" class="interlanguage-link-target"><span>Walon</span></a></li><li class="interlanguage-link interwiki-zh-yue mw-list-item"><a href="https://zh-yue.wikipedia.org/wiki/Template:%E6%AF%8F%E5%9C%88" title="Template:每圈 – Cantonese" lang="yue" hreflang="yue" data-title="Template:每圈" data-language-autonym="粵語" data-language-local-name="Cantonese" class="interlanguage-link-target"><span>粵語</span></a></li><li class="interlanguage-link interwiki-diq mw-list-item"><a href="https://diq.wikipedia.org/wiki/%C5%9Eablon:For_loop" title="Şablon:For loop – Zazaki" lang="diq" hreflang="diq" data-title="Şablon:For loop" data-language-autonym="Zazaki" data-language-local-name="Zazaki" class="interlanguage-link-target"><span>Zazaki</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/Template:For_loop" title="Template:For loop – Chinese" lang="zh" hreflang="zh" data-title="Template:For loop" data-language-autonym="中文" data-language-local-name="Chinese" class="interlanguage-link-target"><span>中文</span></a></li><li class="interlanguage-link interwiki-bdr mw-list-item"><a href="https://bdr.wikipedia.org/wiki/Templat:For_loop" title="Templat:For loop – West Coast Bajau" lang="bdr" hreflang="bdr" data-title="Templat:For loop" data-language-autonym="Bajau Sama" data-language-local-name="West Coast Bajau" class="interlanguage-link-target"><span>Bajau Sama</span></a></li><li class="interlanguage-link interwiki-bew mw-list-item"><a href="https://bew.wikipedia.org/wiki/Sablonan:For_loop" title="Sablonan:For loop – Betawi" lang="bew" hreflang="bew" data-title="Sablonan:For loop" data-language-autonym="Betawi" data-language-local-name="Betawi" class="interlanguage-link-target"><span>Betawi</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/Q10966397#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-template" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Template:For_loop" title="View the template [c]" accesskey="c"><span>Template</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Template_talk:For_loop" 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/Template:For_loop"><span>Read</span></a></li><li id="ca-viewsource" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Template:For_loop&action=edit" title="This page is protected. You can view its source [e]" accesskey="e"><span>View source</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Template:For_loop&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/Template:For_loop"><span>Read</span></a></li><li id="ca-more-viewsource" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Template:For_loop&action=edit"><span>View source</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Template:For_loop&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/Template:For_loop" 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/Template:For_loop" 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="/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Template:For_loop&oldid=851685775" 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=Template:For_loop&action=info" title="More information about this page"><span>Page information</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%2FTemplate%3AFor_loop"><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%2FTemplate%3AFor_loop"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-electronpdfservice-sidebar-portlet-heading" class="vector-menu mw-portlet mw-portlet-electronpdfservice-sidebar-portlet-heading" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="electron-print_pdf" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&page=Template%3AFor_loop&action=show-download-screen"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="javascript:print();" rel="alternate" 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 class="wb-otherproject-link wb-otherproject-commons mw-list-item"><a href="https://commons.wikimedia.org/wiki/Template:For" hreflang="en"><span>Wikimedia Commons</span></a></li><li class="wb-otherproject-link wb-otherproject-meta mw-list-item"><a href="https://meta.wikimedia.org/wiki/Template:For" hreflang="en"><span>Meta-Wiki</span></a></li><li class="wb-otherproject-link wb-otherproject-outreach mw-list-item"><a href="https://outreach.wikimedia.org/wiki/Template:For_loop" hreflang="en"><span>Wikimedia Outreach</span></a></li><li class="wb-otherproject-link wb-otherproject-wikiversity mw-list-item"><a href="https://en.wikiversity.org/wiki/Template:For_loop" hreflang="en"><span>Wikiversity</span></a></li><li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q10966397" 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 id="mw-indicator-pp-default" class="mw-indicator"><div class="mw-parser-output"><span typeof="mw:File"><a href="/wiki/Wikipedia:Protection_policy#template" title="This high-risk template is permanently template-protected to prevent vandalism"><img alt="Permanently protected template" src="//upload.wikimedia.org/wikipedia/en/thumb/5/53/Template-protection-shackle.svg/20px-Template-protection-shackle.svg.png" decoding="async" width="20" height="20" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/5/53/Template-protection-shackle.svg/30px-Template-protection-shackle.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/5/53/Template-protection-shackle.svg/40px-Template-protection-shackle.svg.png 2x" data-file-width="512" data-file-height="512" /></a></span></div></div> </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"><style data-mw-deduplicate="TemplateStyles:r1237875617">.mw-parser-output .documentation,.mw-parser-output .documentation-metadata{border:1px solid #a2a9b1;background-color:#ecfcf4;clear:both}.mw-parser-output .documentation{margin:1em 0 0 0;padding:1em}.mw-parser-output .documentation-metadata{margin:0.2em 0;font-style:italic;padding:0.4em 1em}.mw-parser-output .documentation-startbox{padding-bottom:3px;border-bottom:1px solid #aaa;margin-bottom:1ex}.mw-parser-output .documentation-heading{font-weight:bold;font-size:125%}.mw-parser-output .documentation-clear{clear:both}.mw-parser-output .documentation-toolbar{font-style:normal;font-size:85%}@media screen{html.skin-theme-clientpref-night .mw-parser-output .documentation,html.skin-theme-clientpref-night .mw-parser-output .documentation-metadata{background-color:#0b1e1c}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .documentation,html.skin-theme-clientpref-os .mw-parser-output .documentation-metadata{background-color:#0b1e1c}}</style><div class="documentation-container" role="complementary" aria-labelledby="documentation-heading"> <div class="documentation"> <div class="documentation-startbox"> <span class="documentation-heading" id="documentation-heading"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/4/43/Test_Template_Info-Icon_-_Version_%282%29.svg/50px-Test_Template_Info-Icon_-_Version_%282%29.svg.png" decoding="async" width="50" height="22" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/4/43/Test_Template_Info-Icon_-_Version_%282%29.svg/75px-Test_Template_Info-Icon_-_Version_%282%29.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/4/43/Test_Template_Info-Icon_-_Version_%282%29.svg/100px-Test_Template_Info-Icon_-_Version_%282%29.svg.png 2x" data-file-width="1792" data-file-height="800" /></span></span> Template documentation</span><span class="mw-editsection-like plainlinks">[<a href="/wiki/Template:For_loop/doc" title="Template:For loop/doc">view</a>] [<a href="/wiki/Special:EditPage/Template:For_loop/doc" title="Special:EditPage/Template:For loop/doc">edit</a>] [<a href="/wiki/Special:PageHistory/Template:For_loop/doc" title="Special:PageHistory/Template:For loop/doc">history</a>] [<a href="/wiki/Special:Purge/Template:For_loop" title="Special:Purge/Template:For loop">purge</a>]</span></div> <style data-mw-deduplicate="TemplateStyles:r1238436933">.mw-parser-output .ombox{margin:4px 0;border-collapse:collapse;border:1px solid #a2a9b1;background-color:var(--background-color-neutral-subtle,#f8f9fa);box-sizing:border-box;color:var(--color-base,#202122)}.mw-parser-output .ombox.mbox-small{font-size:88%;line-height:1.25em}.mw-parser-output .ombox-speedy{border:2px solid #b32424;background-color:#fee7e6}.mw-parser-output .ombox-delete{border:2px solid #b32424}.mw-parser-output .ombox-content{border:1px solid #f28500}.mw-parser-output .ombox-style{border:1px solid #fc3}.mw-parser-output .ombox-move{border:1px solid #9932cc}.mw-parser-output .ombox-protection{border:2px solid #a2a9b1}.mw-parser-output .ombox .mbox-text{border:none;padding:0.25em 0.9em;width:100%}.mw-parser-output .ombox .mbox-image{border:none;padding:2px 0 2px 0.9em;text-align:center}.mw-parser-output .ombox .mbox-imageright{border:none;padding:2px 0.9em 2px 0;text-align:center}.mw-parser-output .ombox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ombox .mbox-invalid-type{text-align:center}@media(min-width:720px){.mw-parser-output .ombox{margin:4px 10%}.mw-parser-output .ombox.mbox-small{clear:right;float:right;margin:4px 0 4px 1em;width:238px}}body.skin--responsive .mw-parser-output table.ombox img{max-width:none!important}@media screen{html.skin-theme-clientpref-night .mw-parser-output .ombox-speedy{background-color:#310402}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .ombox-speedy{background-color:#310402}}</style><table class="plainlinks ombox ombox-content" role="presentation"><tbody><tr><td class="mbox-image"><span typeof="mw:File"><span><img alt="Warning" src="//upload.wikimedia.org/wikipedia/en/thumb/5/5f/Ambox_warning_orange.svg/40px-Ambox_warning_orange.svg.png" decoding="async" width="40" height="34" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/5/5f/Ambox_warning_orange.svg/60px-Ambox_warning_orange.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/5/5f/Ambox_warning_orange.svg/80px-Ambox_warning_orange.svg.png 2x" data-file-width="378" data-file-height="326" /></span></span></td><td class="mbox-text"><b>This template is used on <a class="external text" href="https://linkcount.toolforge.org/?project=en.wikipedia.org&page=Template%3AFor+loop#transclusions">approximately 798,000 pages, or roughly 1% of all pages</a></b>.<br /> To avoid major disruption and server load, any changes should be tested in the template's <a href="/wiki/Template:For_loop/sandbox" title="Template:For loop/sandbox">/sandbox</a> or <a href="/w/index.php?title=Template:For_loop/testcases&action=edit&redlink=1" class="new" title="Template:For loop/testcases (page does not exist)">/testcases</a> subpages, or in your own <a href="/wiki/Wikipedia:User_pages#SUB" title="Wikipedia:User pages">user subpage</a>. The tested changes can be added to this page in a single edit. Consider discussing changes on the <a href="/wiki/Template_talk:For_loop" title="Template talk:For loop">talk page</a> before implementing them.</td></tr></tbody></table> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238436933"><table class="plainlinks ombox mbox-small ombox-notice" role="presentation"><tbody><tr><td class="mbox-image"><span typeof="mw:File"><span><img alt="" src="//upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Lua-Logo.svg/30px-Lua-Logo.svg.png" decoding="async" width="30" height="30" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Lua-Logo.svg/45px-Lua-Logo.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Lua-Logo.svg/60px-Lua-Logo.svg.png 2x" data-file-width="947" data-file-height="947" /></span></span></td><td class="mbox-text">This template uses <a href="/wiki/Wikipedia:Lua" title="Wikipedia:Lua">Lua</a>: <div><ul><li><a href="/wiki/Module:For_loop" title="Module:For loop">Module:For loop</a> (<a href="/wiki/Module:For_loop/sandbox" title="Module:For loop/sandbox">sandbox</a>)</li></ul></div></td></tr></tbody></table> <p>This template implements a <a href="/wiki/For_loop" title="For loop">for loop</a> or a <a href="/wiki/Foreach_loop" title="Foreach loop">foreach loop</a>. </p><p>This template calls a user-specified template (the "called template") multiple times: once for each value in either 1) an iterated sequence or 2) an explicit list. Each value in the sequence or list is passed to the same specified parameter of the called template (the "variable parameter"). Optionally, pre- and postfixes can be attached to the passed values. </p><p>In addition to the specified variable parameter, other parameters of the called template ("static parameters") can be given a value which is the same in each iteration. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Usage">Usage</h2></div> <table class="wikitable"> <tbody><tr> <th>Group</th> <th>Parameter</th> <th>Meaning</th> <th>Default value </th></tr> <tr> <th scope="row" rowspan="3">Mandatory </th> <td><b>1 (unnamed)</b></td> <td>separator to output between calls (may be blank; whitespace is preserved)</td> <td> </td></tr> <tr> <td><b>call</b></td> <td>template to call</td> <td> </td></tr> <tr> <td><b>pv</b></td> <td>name (or number) of the variable parameter of the called template</td> <td style="text-align: center">1 </td></tr> <tr style="border-top: 3px solid grey;"> <th scope="row" rowspan="3">Option 1:<br />iterated sequence </th> <td><b>start</b></td> <td>first numeric value to pass to variable parameter</td> <td style="text-align: center">1 </td></tr> <tr> <td><b>stop</b></td> <td>maximum numeric value for variable parameter</td> <td> </td></tr> <tr> <td><b>by</b></td> <td>iteration step size between values passed to variable parameter</td> <td style="text-align: center">1 </td></tr> <tr style="border-top: 3px solid grey;"> <th scope="row" rowspan="2">Option 2:<br />explicit values </th> <td><b>(unnamed parameters)</b></td> <td>explicit values, given as separate parameters (whitespace is stripped)</td> <td> </td></tr> <tr> <td><b>skipBlanks</b></td> <td>set to "true" to skip empty parameter values</td> <td style="text-align: center">false </td></tr> <tr style="border-top: 3px solid grey;"> <th scope="row" rowspan="5">Other optional<br />parameters </th> <td><b>pc[N]n</b></td> <td>name (or number) of the Nth static parameter of the called template</td> <td> </td></tr> <tr> <td><b>pc[N]v</b></td> <td>value for the Nth static parameter of the called template</td> <td> </td></tr> <tr> <td><b>prefix</b></td> <td>static prefix prepended to each value passed to the variable parameter</td> <td> </td></tr> <tr> <td><b>postfix</b></td> <td>static postfix appended to each value passed to the variable parameter</td> <td> </td></tr> <tr> <td><b>substall</b></td> <td>set to "false" to not substitute the called template when <span class="nowrap">{{</span><a class="mw-selflink selflink">for loop</a><span class="nowrap">}}</span> is substituted</td> <td style="text-align: center">true </td></tr></tbody></table> <p><i>Either</i> option 1 (iteration parameters) <i>or</i> option 2 (an explicit list of values) may be used, but not both. </p><p>The first unnamed parameter, prior to any explicit values, is a separator. The separator is a string that is output <i>between</i> calls to the template named in <code>|call=</code>. It is not output after the last call. </p> <div class="mw-heading mw-heading3"><h3 id="Caution">Caution</h3></div> <ul><li>The separator can be prefixed with "1=", but in that case it cannot contain newlines and spaces at the start and end.</li> <li>If any parameter value contains an equals sign, use <code>{{<a href="/wiki/Template:%3D" title="Template:=">=</a>}}</code> (see <a href="/wiki/Help:Template#Usage_hints_and_workarounds" title="Help:Template">Template Usage hints and workarounds</a>).</li> <li>If you use numbered parameters, note that the first value is parameter 2 (e.g. <code>|2=Your1stValue</code>), because parameter 1 is the separator.</li> <li>If you use numbered parameters, you must not skip any numbers. The loop will terminate after the first absent numbered parameter. (Parameters can be blank, but not absent.)</li></ul> <div class="mw-heading mw-heading3"><h3 id="Substitution">Substitution</h3></div> <p>The current Lua-based template supports <a href="/wiki/Wikipedia:SUBST" class="mw-redirect" title="Wikipedia:SUBST">substitution</a>. If <code class="tpl-para" style="word-break:break-word;">|substall=no</code> is not specified, then substituting the template will substitute everything, including the call to the template passed in <code class="tpl-para" style="word-break:break-word;">|call=</code>. If it is specified, then the template substitutes into a sequence of calls to the template specified. </p><p>Example: <code>{{<a class="mw-selflink selflink">subst:for loop</a>|sep|01|02|03|04|05|06|07|call=1x}}</code> -> <code>01sep 02sep 03sep 04sep 05sep 06sep 07</code>, <code>{{<a class="mw-selflink selflink">subst:for loop</a>|sep|01|02|03|04|05|06|07|substall=no}}</code> -> <code>{{1x|01}}sep {{1x|02}}sep {{1x|03}}sep {{1x|04}}sep {{1x|05}}sep {{1x|06}}sep {{1x|07}}</code> </p><p>For full substitution <a href="/wiki/Special:ExpandTemplates" title="Special:ExpandTemplates">Special:ExpandTemplates</a> can also be used. </p> <div class="mw-heading mw-heading2"><h2 id="Examples">Examples</h2></div> <table class="wikitable"> <tbody><tr> <th>Form </th> <th style="width: 185px;">Code </th> <th>Explanation </th> <th>Result </th></tr> <tr> <th scope="row">Iterator </th> <td> <div class="mw-highlight mw-highlight-lang-wikitext mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{{</span><span class="nt">for loop</span><span class="p">|</span>& <span class="p">|</span><span class="nl">call </span><span class="o">=</span> spanbox <span class="p">|</span><span class="nl">pv </span><span class="o">=</span> font size <span class="p">|</span><span class="nl">start</span><span class="o">=</span>10 <span class="p">|</span><span class="nl">stop</span><span class="o">=</span>52 <span class="p">|</span><span class="nl">by</span><span class="o">=</span>8 <span class="p">|</span><span class="nl">postfix </span><span class="o">=</span> px <span class="p">|</span><span class="nl">pc1n </span><span class="o">=</span> 1 <span class="p">|</span><span class="nl">pc1v </span><span class="o">=</span> A <span class="p">|</span><span class="nl">pc2n </span><span class="o">=</span> background <span class="p">|</span><span class="nl">pc2v </span><span class="o">=</span> yellow <span class="p">}}</span> </pre></div> </td> <td>Call the template "spanbox" with values: <ul><li>font size = "[N]px", where N takes values starting with 10 and increasing by 8 while remaining less than or equal to 52</li> <li>1 (first unnamed parameter) = "A"</li> <li>background = "yellow"</li></ul> <p>Separating outputs with "&" </p> </td> <td><div style="display:inline-block;border-style: solid;padding: 3px;border-color: black;border-width: 2px;background-color: yellow;color: black;font-size: 10px;margin: 3px;">A</div>&<div style="display:inline-block;border-style: solid;padding: 3px;border-color: black;border-width: 2px;background-color: yellow;color: black;font-size: 18px;margin: 3px;">A</div>&<div style="display:inline-block;border-style: solid;padding: 3px;border-color: black;border-width: 2px;background-color: yellow;color: black;font-size: 26px;margin: 3px;">A</div>&<div style="display:inline-block;border-style: solid;padding: 3px;border-color: black;border-width: 2px;background-color: yellow;color: black;font-size: 34px;margin: 3px;">A</div>&<div style="display:inline-block;border-style: solid;padding: 3px;border-color: black;border-width: 2px;background-color: yellow;color: black;font-size: 42px;margin: 3px;">A</div>&<div style="display:inline-block;border-style: solid;padding: 3px;border-color: black;border-width: 2px;background-color: yellow;color: black;font-size: 50px;margin: 3px;">A</div> </td></tr> <tr> <th scope="row">Explicit values </th> <td><div class="mw-highlight mw-highlight-lang-wikitext mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{{</span><span class="nt">for loop</span><span class="p">|</span>, <span class="p">|</span><span class="nl">call</span><span class="o">=</span>2x <span class="p">|</span><span class="nl">prefix</span><span class="o">=</span>1 <span class="p">|</span>00<span class="p">|</span>01<span class="p">|</span>02<span class="p">|</span>03<span class="p">|</span>04<span class="p">|</span>05<span class="p">|</span>06<span class="p">|</span>07<span class="p">|</span>08<span class="p">|</span>09 <span class="p">|</span>10<span class="p">|</span>11<span class="p">|</span>12<span class="p">|</span>13<span class="p">|</span>14<span class="p">|</span>15<span class="p">|</span>16<span class="p">|</span>17<span class="p">|</span>18<span class="p">|</span>19 <span class="p">|</span>20<span class="p">|</span>21<span class="p">|</span>22<span class="p">|</span>23<span class="p">|</span>24<span class="p">|</span>25<span class="p">|</span>26<span class="p">|</span>27<span class="p">|</span>28<span class="p">|</span>29 <span class="p">|</span>30<span class="p">|</span>31<span class="p">|</span>32<span class="p">|</span>33<span class="p">|</span>34<span class="p">|</span>35<span class="p">|</span>36<span class="p">|</span>37<span class="p">|</span>38<span class="p">|</span>39 <span class="p">|</span>40<span class="p">|</span>41<span class="p">|</span>42<span class="p">|</span>43<span class="p">|</span>44<span class="p">|</span>45<span class="p">|</span>46<span class="p">|</span>47<span class="p">|</span>48<span class="p">|</span>49 <span class="p">|</span>50<span class="p">|</span>51<span class="p">|</span>52<span class="p">|</span>53<span class="p">|</span>54<span class="p">|</span>55<span class="p">|</span>56<span class="p">|</span>57<span class="p">|</span>58<span class="p">|</span>59 <span class="p">|</span>60<span class="p">|</span>61<span class="p">|</span>62<span class="p">|</span>63<span class="p">|</span>64<span class="p">|</span>65<span class="p">|</span>66<span class="p">|</span>67<span class="p">|</span>68<span class="p">|</span>69 <span class="p">|</span>70<span class="p">|</span>71<span class="p">|</span>72<span class="p">|</span>73<span class="p">|</span>74<span class="p">|</span>75<span class="p">|</span>76<span class="p">|</span>77<span class="p">|</span>78<span class="p">|</span>79 <span class="p">|</span>80<span class="p">|</span>81<span class="p">|</span>82<span class="p">|</span>83<span class="p">|</span>84<span class="p">|</span>85<span class="p">|</span>86<span class="p">|</span>87<span class="p">|</span>88<span class="p">|</span>89 <span class="p">|</span>90<span class="p">|</span>91<span class="p">|</span>92<span class="p">|</span>93<span class="p">|</span>94<span class="p">|</span>95<span class="p">|</span>96<span class="p">|</span>97<span class="p">|</span>98<span class="p">|</span>99 <span class="p">}}</span> </pre></div> </td> <td>Call the template <span class="nowrap">{{</span><a href="/wiki/Template:2x" title="Template:2x">2x</a><span class="nowrap">}}</span> (which just repeats its input twice) with values "1[NN]", where NN = "00" through "99" (given explicitly), separating the outputs with the string ", " </td> <td>100100, 101101, 102102, 103103, 104104, 105105, 106106, 107107, 108108, 109109, 110110, 111111, 112112, 113113, 114114, 115115, 116116, 117117, 118118, 119119, 120120, 121121, 122122, 123123, 124124, 125125, 126126, 127127, 128128, 129129, 130130, 131131, 132132, 133133, 134134, 135135, 136136, 137137, 138138, 139139, 140140, 141141, 142142, 143143, 144144, 145145, 146146, 147147, 148148, 149149, 150150, 151151, 152152, 153153, 154154, 155155, 156156, 157157, 158158, 159159, 160160, 161161, 162162, 163163, 164164, 165165, 166166, 167167, 168168, 169169, 170170, 171171, 172172, 173173, 174174, 175175, 176176, 177177, 178178, 179179, 180180, 181181, 182182, 183183, 184184, 185185, 186186, 187187, 188188, 189189, 190190, 191191, 192192, 193193, 194194, 195195, 196196, 197197, 198198, 199199 </td></tr> <tr> <th scope="row">Explicit values </th> <td><div class="mw-highlight mw-highlight-lang-wikitext mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{{</span><span class="nt">for loop</span><span class="p">||</span><span class="nl">call</span><span class="o">=</span>tsh<span class="p">|</span><span class="nl">skipBlanks</span><span class="o">=</span>true<span class="p">|{{</span><span class="nf">#switch</span><span class="p">:{{</span><span class="nf">ROOTPAGENAME</span><span class="p">}}</span> <span class="p">|</span><span class="nl">Namespace links</span><span class="o">=</span>ln <span class="p">|</span><span class="nl">Article links</span><span class="o">=</span>la <span class="p">}}}}</span> <span class="cm"><!--Don't show {{tsh}} for |Lafd=lafd --></span> </pre></div> </td> <td><span class="nowrap">{{</span><a class="mw-selflink selflink">for loop</a><span class="nowrap">}}</span> is useful for omitting a template call with one parameter being an inline expression that can be empty. It avoids repeating the parameter that the usual <code>{{{1|}}} {{#if:{{{1|}}}|{{example|{{{1}}}}}}}</code> does. </td> <td>(<span class="nowrap">{{</span><a class="mw-selflink selflink">for loop</a><span class="nowrap">}}</span> helped avoid the error message) </td></tr></tbody></table> <div class="mw-heading mw-heading3"><h3 id="Other_examples_with_explicit_values">Other examples with explicit values</h3></div> <div class="mw-highlight mw-highlight-lang-wikitext mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{{</span><span class="nt">for loop</span><span class="p">|</span>-<span class="p">|</span>a<span class="p">|</span>3<span class="p">||</span>c<span class="p">|</span>g<span class="p">|</span><span class="nl">call</span><span class="o">=</span>3x<span class="p">}}</span> </pre></div> using <span class="plainlinks"><a href="/wiki/Template:3x" title="Template:3x">Template:3x</a> <span style="font-size:85%;">(<a href="/wiki/Special:WhatLinksHere/Template:3x" title="Special:WhatLinksHere/Template:3x">backlinks</a> <a class="external text" href="https://en.wikipedia.org/w/index.php?title=Template:3x&action=edit">edit</a>)</span></span> gives <p>aaa-333-ccc-ggg </p> <div class="mw-highlight mw-highlight-lang-wikitext mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{{</span><span class="nt">for loop</span><span class="p">|</span> <span class="p">|</span>a<span class="p">|</span>3<span class="p">||</span>c<span class="p">|</span>g<span class="p">|</span><span class="nl">call</span><span class="o">=</span>3x<span class="p">}}</span> </pre></div> gives <p>aaa </p><p>333 </p><p>ccc </p><p>ggg </p> <div class="mw-highlight mw-highlight-lang-wikitext mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{|</span><span class="na">class</span><span class="o">=</span><span class="s2">"wikitable sortable"</span> <span class="p">!</span><span class="gu">Test</span> <span class="p">|-</span> <span class="p">|</span> <span class="p">{{</span><span class="nt">for loop</span><span class="p">|</span> <span class="p">{{</span><span class="nf">!</span><span class="p">}}</span>- <span class="p">{{</span><span class="nf">!</span><span class="p">}}</span> <span class="p">|</span>a<span class="p">|</span>b<span class="p">|</span>c<span class="p">|</span>d<span class="p">|</span>e<span class="p">|</span><span class="nl">call</span><span class="o">=</span>3x<span class="p">}}</span> <span class="p">|}</span> </pre></div> <p>gives: </p> <table class="wikitable sortable"> <tbody><tr> <th>Test </th></tr> <tr> <td>aaa </td></tr> <tr> <td>bbb </td></tr> <tr> <td>ccc </td></tr> <tr> <td>ddd </td></tr> <tr> <td>eee </td></tr></tbody></table> <div class="mw-highlight mw-highlight-lang-wikitext mw-content-ltr" dir="ltr"><pre><span></span><span class="p">{{</span><span class="nt">for loop</span><span class="p">|</span> <span class="p">|</span>01<span class="p">|</span>02<span class="p">|</span>03<span class="p">|</span>04<span class="p">|</span>05<span class="p">|</span>06<span class="p">|</span>07<span class="p">|</span>08<span class="p">|</span>09<span class="p">|</span>10<span class="p">|</span>11<span class="p">|</span>12<span class="p">|</span>13<span class="p">|</span>14<span class="p">|</span>15<span class="p">|</span>16<span class="p">|</span>17<span class="p">|</span>18<span class="p">|</span>19 <span class="p">|</span>20<span class="p">|</span>21<span class="p">|</span>22<span class="p">|</span>23<span class="p">|</span>24<span class="p">|</span>25<span class="p">|</span>26<span class="p">|</span>27<span class="p">|</span>28<span class="p">|</span>29<span class="p">|</span>30<span class="p">|</span>31<span class="p">|</span>32<span class="p">|</span>33<span class="p">|</span>34<span class="p">|</span>35<span class="p">|</span>36<span class="p">|</span>37<span class="p">|</span>38<span class="p">|</span>39 <span class="p">|</span>40<span class="p">|</span>41<span class="p">|</span>42<span class="p">|</span>43<span class="p">|</span>44<span class="p">|</span>45<span class="p">|</span>46<span class="p">|</span>47<span class="p">|</span>48<span class="p">|</span>49<span class="p">|</span>50<span class="p">|</span>51<span class="p">|</span>52<span class="p">|</span>53<span class="p">|</span>54<span class="p">|</span>55<span class="p">|</span>56<span class="p">|</span>57<span class="p">|</span>58<span class="p">|</span>59 <span class="p">|</span>60<span class="p">|</span>61<span class="p">|</span>62<span class="p">|</span>63<span class="p">|</span>64<span class="p">|</span>65<span class="p">|</span>66<span class="p">|</span>67<span class="p">|</span>68<span class="p">|</span>69<span class="p">|</span>70<span class="p">|</span>71<span class="p">|</span>72<span class="p">|</span>73<span class="p">|</span>74<span class="p">|</span>75<span class="p">|</span>76<span class="p">|</span>77<span class="p">|</span>78<span class="p">|</span>79 <span class="p">|</span>80<span class="p">|</span>81<span class="p">|</span>82<span class="p">|</span>83<span class="p">|</span>84<span class="p">|</span>85<span class="p">|</span>86<span class="p">|</span>87<span class="p">|</span>88<span class="p">|</span>89<span class="p">|</span>90<span class="p">|</span>91<span class="p">|</span>92<span class="p">|</span>93<span class="p">|</span>94<span class="p">|</span>95<span class="p">|</span>96<span class="p">|</span>97<span class="p">|</span>98<span class="p">|</span>99 <span class="p">|</span>100<span class="p">|</span>101<span class="p">|</span>102<span class="p">|</span>103<span class="p">|</span>104<span class="p">|</span>105<span class="p">|</span>106<span class="p">|</span>107<span class="p">|</span>108<span class="p">|</span>109<span class="p">|</span>110<span class="p">|</span>111<span class="p">|</span>112<span class="p">|</span>113<span class="p">|</span>114<span class="p">|</span>115<span class="p">|</span>116<span class="p">|</span>117<span class="p">|</span>118<span class="p">|</span>119 <span class="p">|</span>120<span class="p">|</span>121<span class="p">|</span>122<span class="p">|</span>123<span class="p">|</span>124<span class="p">|</span>125<span class="p">|</span>126<span class="p">|</span>127<span class="p">|</span>128<span class="p">|</span>129<span class="p">|</span>130<span class="p">|</span>131<span class="p">|</span>132<span class="p">|</span>133<span class="p">|</span>134<span class="p">|</span>135<span class="p">|</span>136<span class="p">|</span>137<span class="p">|</span>138<span class="p">|</span>139 <span class="p">|</span>140<span class="p">|</span>141<span class="p">|</span>142<span class="p">|</span>143<span class="p">|</span>144<span class="p">|</span>145<span class="p">|</span>146<span class="p">|</span>147<span class="p">|</span>148<span class="p">|</span>149<span class="p">|</span>150<span class="p">|</span>151<span class="p">|</span>152<span class="p">|</span>153<span class="p">|</span>154<span class="p">|</span><span class="nl">call</span><span class="o">=</span>1x<span class="p">}}</span> </pre></div> <p>gives: </p><p>01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 </p> <div class="mw-highlight mw-highlight-lang-wikitext mw-content-ltr" dir="ltr"><pre><span></span>begin-><span class="p">{{</span><span class="nt">for loop</span><span class="p">|{{</span><span class="nf">=</span><span class="p">}}</span> <span class="p">|</span>01<span class="p">|</span>02<span class="p">|</span>03<span class="p">|</span>04<span class="p">|</span>05<span class="p">|</span>06<span class="p">|</span>07<span class="p">|</span>08<span class="p">|</span>09<span class="p">|</span>10 <span class="p">|</span>11<span class="p">{{</span><span class="nf">=</span><span class="p">}}{{</span><span class="nf">=</span><span class="p">}}{{</span><span class="nf">=</span><span class="p">}}|</span>12<span class="p">|</span>13<span class="p">|</span>14<span class="p">|</span>15<span class="p">|</span>16<span class="p">|</span>17<span class="p">|</span>18<span class="p">|</span>19<span class="p">|</span><span class="nl">call</span><span class="o">=</span>1x<span class="p">}}</span><-end </pre></div> <p>gives: </p><p>begin->01= 02= 03= 04= 05= 06= 07= 08= 09= 10= 11==== 12= 13= 14= 15= 16= 17= 18= 19<-end </p> <div class="mw-heading mw-heading2"><h2 id="Notes_about_legacy_code">Notes about legacy code</h2></div> <p>This template is currently in its third incarnation. It now uses the <a href="/wiki/Wikipedia:Lua" title="Wikipedia:Lua">Lua</a> code at <a href="/wiki/Module:For_loop" title="Module:For loop">Module:For loop</a>. It was ported to Lua from <a href="https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions" class="extiw" title="mw:Help:Extension:ParserFunctions">ParserFunctions</a>. There was also a previous version with a named "sep" parameter to specify the separator value. The template was originally based on <a href="https://meta.wikimedia.org/wiki/Template:For" class="extiw" title="m:Template:For">Template:For on meta</a>. The template name was changed because there was already a <a href="/wiki/Template:For" title="Template:For">Template:For on Wikipedia</a>. </p><p>The old versions were limited to 150 variable values and four fixed parameters. There are no such limits in the current version. Also, in the first version the "sep" parameter didn't allow whitespace in the separator value. This was fixed with the second version and was retained in the current version. </p> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div> <ul><li><a href="https://www.mediawiki.org/wiki/Template:Fe" class="extiw" title="mw:Template:Fe">mw:Template:Fe</a></li> <li><a href="https://www.mediawiki.org/wiki/Template:foreach" class="extiw" title="mw:Template:foreach">mw:Template:foreach</a></li> <li><a href="https://meta.wikimedia.org/wiki/Template:tblb" class="extiw" title="m:Template:tblb">m:Template:tblb</a> <span style="font-size:85%;">(<a href="https://meta.wikimedia.org/wiki/Special:Whatlinkshere/Template:tblb" class="extiw" title="m:Special:Whatlinkshere/Template:tblb">backlinks</a> <a class="external text" href="https://meta.wikimedia.org/wiki/Template:tblb?action=edit">edit</a>)</span></li> <li><span class="plainlinks"><a href="/wiki/Template:For_nowiki" title="Template:For nowiki">Template:for nowiki</a> <span style="font-size:85%;">(<a href="/wiki/Special:WhatLinksHere/Template:for_nowiki" title="Special:WhatLinksHere/Template:for nowiki">backlinks</a> <a class="external text" href="https://en.wikipedia.org/w/index.php?title=Template:For_nowiki&action=edit">edit</a>)</span></span></li> <li><span class="plainlinks"><a href="/wiki/Template:Item" title="Template:Item">Template:item</a> <span style="font-size:85%;">(<a href="/wiki/Special:WhatLinksHere/Template:item" title="Special:WhatLinksHere/Template:item">backlinks</a> <a class="external text" href="https://en.wikipedia.org/w/index.php?title=Template:Item&action=edit">edit</a>)</span></span></li> <li><span class="plainlinks"><a href="/wiki/Template:Loop" title="Template:Loop">Template:loop</a> <span style="font-size:85%;">(<a href="/wiki/Special:WhatLinksHere/Template:loop" title="Special:WhatLinksHere/Template:loop">backlinks</a> <a class="external text" href="https://en.wikipedia.org/w/index.php?title=Template:Loop&action=edit">edit</a>)</span></span></li> <li><span class="plainlinks"><a href="/wiki/Template:Simple_recursion" title="Template:Simple recursion">Template:simple recursion</a> <span style="font-size:85%;">(<a href="/wiki/Special:WhatLinksHere/Template:simple_recursion" title="Special:WhatLinksHere/Template:simple recursion">backlinks</a> <a class="external text" href="https://en.wikipedia.org/w/index.php?title=Template:Simple_recursion&action=edit">edit</a>)</span></span></li> <li><a href="/wiki/Help:Parameter_default" title="Help:Parameter default">Help:Parameter default</a></li> <li><a href="/wiki/Help:Array" title="Help:Array">Help:Array</a></li> <li><a href="https://www.mediawiki.org/wiki/Extension:LoopFunctions" class="extiw" title="mw:Extension:LoopFunctions">mw:Extension:LoopFunctions</a></li> <li><a href="https://www.mediawiki.org/wiki/Extension:Loops" class="extiw" title="mw:Extension:Loops">mw:Extension:Loops</a></li></ul> <div class="documentation-clear"></div> </div> <div role="note" class="documentation-metadata plainlinks">The above <a href="/wiki/Wikipedia:Template_documentation" title="Wikipedia:Template documentation">documentation</a> is <a href="/wiki/Help:Transclusion" title="Help:Transclusion">transcluded</a> from <a href="/wiki/Template:For_loop/doc" title="Template:For loop/doc">Template:For loop/doc</a>. <span class="documentation-toolbar">(<a href="/wiki/Special:EditPage/Template:For_loop/doc" title="Special:EditPage/Template:For loop/doc">edit</a> | <a href="/wiki/Special:PageHistory/Template:For_loop/doc" title="Special:PageHistory/Template:For loop/doc">history</a>)</span><br />Editors can experiment in this template's <a href="/wiki/Template:For_loop/sandbox" title="Template:For loop/sandbox">sandbox</a> <span class="documentation-toolbar">(<a href="/wiki/Special:EditPage/Template:For_loop/sandbox" title="Special:EditPage/Template:For loop/sandbox">edit</a> | <a class="external text" href="https://en.wikipedia.org/w/index.php?title=Special%3AComparePages&page1=Template%3AFor+loop&page2=Template%3AFor+loop%2Fsandbox">diff</a>)</span> and testcases <span class="documentation-toolbar">(<a class="external text" href="https://en.wikipedia.org/w/index.php?title=Template:For_loop/testcases&action=edit&preload=Template%3ADocumentation%2Fpreload-testcases">create</a>)</span> pages.<br />Add categories to the <a href="/wiki/Template:For_loop/doc" title="Template:For loop/doc">/doc</a> subpage. <a href="/wiki/Special:PrefixIndex/Template:For_loop/" title="Special:PrefixIndex/Template:For loop/">Subpages of this template</a>.</div></div> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐6b8d669998‐vwmlw Cached time: 20241128053823 Cache expiry: 2592000 Reduced expiry: false Complications: [vary‐page‐id, vary‐revision‐sha1, show‐toc] CPU time usage: 0.223 seconds Real time usage: 0.527 seconds Preprocessor visited node count: 2867/1000000 Post‐expand include size: 53958/2097152 bytes Template argument size: 2978/2097152 bytes Highest expansion depth: 10/100 Expensive parser function count: 14/500 Unstrip recursion depth: 0/20 Unstrip post‐expand size: 16703/5000000 bytes Lua time usage: 0.123/10.000 seconds Lua memory usage: 2415643/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 457.026 1 -total 100.00% 457.026 1 Template:Documentation 87.89% 401.675 1 Template:For_loop/doc 17.59% 80.381 8 Template:For_loop 8.84% 40.383 1 Template:High-use 2.72% 12.449 1 Template:Lua 1.46% 6.694 5 Template:Tiw 1.26% 5.780 2 Template:Tlxs 1.26% 5.750 1 Template:Sandbox_other 1.14% 5.219 2 Template:Tl --> <!-- Saved in parser cache with key enwiki:pcache:44481616:|#|:idhash:canonical and timestamp 20241128053823 and revision id 851685775. 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?type=1x1&useformat=desktop" 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=Template:For_loop&oldid=851685775">https://en.wikipedia.org/w/index.php?title=Template:For_loop&oldid=851685775</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">Category</a>: <ul><li><a href="/wiki/Category:Repetition_templates" title="Category:Repetition templates">Repetition templates</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:Wikipedia_template-protected_templates" title="Category:Wikipedia template-protected templates">Wikipedia template-protected templates</a></li><li><a href="/wiki/Category:Lua-based_templates" title="Category:Lua-based templates">Lua-based templates</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 23 July 2018, at 22:55<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=Template:For_loop&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://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></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"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-78f4c97c5d-l7hbw","wgBackendResponseTime":144,"wgPageParseReport":{"limitreport":{"cputime":"0.223","walltime":"0.527","ppvisitednodes":{"value":2867,"limit":1000000},"postexpandincludesize":{"value":53958,"limit":2097152},"templateargumentsize":{"value":2978,"limit":2097152},"expansiondepth":{"value":10,"limit":100},"expensivefunctioncount":{"value":14,"limit":500},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":16703,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 457.026 1 -total","100.00% 457.026 1 Template:Documentation"," 87.89% 401.675 1 Template:For_loop/doc"," 17.59% 80.381 8 Template:For_loop"," 8.84% 40.383 1 Template:High-use"," 2.72% 12.449 1 Template:Lua"," 1.46% 6.694 5 Template:Tiw"," 1.26% 5.780 2 Template:Tlxs"," 1.26% 5.750 1 Template:Sandbox_other"," 1.14% 5.219 2 Template:Tl"]},"scribunto":{"limitreport-timeusage":{"value":"0.123","limit":"10.000"},"limitreport-memusage":{"value":2415643,"limit":52428800}},"cachereport":{"origin":"mw-web.codfw.main-6b8d669998-vwmlw","timestamp":"20241128053823","ttl":2592000,"transientcontent":false}}});});</script> </body> </html>