CINXE.COM
Rosetta Code
<!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-0 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Rosetta Code</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-0 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )rosettacodewikimwclientpreferences=([^;]+)/);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":"1073ba611d3e1c197335c2a7","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Rosetta_Code","wgTitle":"Rosetta Code","wgCurRevisionId":368154,"wgRevisionId":368154,"wgArticleId":2,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":[],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Rosetta_Code","wgRelevantArticleId":2,"wgIsProbablyEditable":false,"wgRelevantPageIsProbablyEditable":false,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgIsMainPage":true,"wgNoticeProject":"all","wgCiteReferencePreviewsActive":true,"wgMFDisplayWikibaseDescriptions":{"search":false,"nearby":false,"watchlist":false,"tagline":false},"wgCheckUserClientHintsHeadersJsApi":[ "architecture","bitness","brands","fullVersionList","mobile","model","platform","platformVersion"],"wgIsMobile":false,"wgCentralAuthMobileDomain":false,"wgSiteNoticeId":"89.0"};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.CookieWarning.styles":"ready","oojs-ui-core.styles":"ready","oojs-ui.styles.indicators":"ready","mediawiki.widgets.styles":"ready","oojs-ui-core.icons":"ready","ext.MobileDetect.nomobile":"ready","ext.dismissableSiteNotice.styles":"ready"};RLPAGEMODULES=["ext.smw.styles","smw.entityexaminer","site","mediawiki.page.ready","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.checkUser.clientHints","ext.CookieWarning","ext.echo.centralauth","ext.eventLogging","ext.urlShortener.toolbar","ext.centralauth.centralautologin", "ext.purge","ext.smw.purge","ext.dismissableSiteNotice"];</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.CookieWarning.styles%7Cext.MobileDetect.nomobile%7Cext.dismissableSiteNotice.styles%7Cmediawiki.widgets.styles%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui.styles.indicators%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles&only=styles&skin=vector-2022"> <script async="" src="/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022"></script> <style>#mw-indicator-mw-helplink {display:none;}</style> <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.43.0-beta"> <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="description" content="Rosetta Code is a programming chrestomathy site. The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how..."> <meta name="twitter:site" content=""> <meta name="twitter:card" content="summary_large_image"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="Rosetta Code"> <meta property="og:type" content="website"> <link rel="alternate" type="application/rdf+xml" title="Rosetta Code" href="/wiki/Special:ExportRDF/Rosetta_Code?xmlmime=rdf"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Rosetta Code (en)"> <link rel="EditURI" type="application/rsd+xml" href="https://rosettacode.org/w/api.php?action=rsd"> <link rel="canonical" href="https://rosettacode.org/wiki/Rosetta_Code"> <link rel="alternate" type="application/atom+xml" title="Rosetta Code Atom feed" href="/wiki/Special:RecentChanges?feed=atom"> <link rel="dns-prefetch" href="https://meta.miraheze.org" /> <meta property="og:title" content="Rosetta Code"> <meta property="og:site_name" content="Rosetta Code"> <meta property="og:url" content="https://rosettacode.org/wiki/Rosetta_Code"> <meta property="og:description" content="Rosetta Code is a programming chrestomathy site. The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how..."> <meta property="og:image" content="https://static.miraheze.org/rosettacodewiki/d/d3/RosettaCodeTitle.png"> <meta property="article:modified_time" content="2024-11-28T11:57:29Z"> <meta property="article:published_time" content="2024-11-28T11:57:29Z"> <script type="application/ld+json">{"@context":"http:\/\/schema.org","@type":"Article","name":"Rosetta Code","headline":"Rosetta Code","mainEntityOfPage":"Rosetta Code","identifier":"https:\/\/rosettacode.org\/wiki\/Rosetta_Code","url":"https:\/\/rosettacode.org\/wiki\/Rosetta_Code","description":"Rosetta Code is a programming chrestomathy site. The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how...","dateModified":"2024-11-28T11:57:29Z","datePublished":"2024-11-28T11:57:29Z","image":{"@type":"ImageObject","url":"https:\/\/static.miraheze.org\/rosettacodewiki\/d\/d3\/RosettaCodeTitle.png"},"author":{"@type":"Organization","name":"Rosetta Code","url":"https:\/\/rosettacode.org","logo":{"@type":"ImageObject","url":"https:\/\/static.miraheze.org\/rosettacodewiki\/d\/d3\/RosettaCodeTitle.png","caption":"Rosetta Code"}},"publisher":{"@type":"Organization","name":"Rosetta Code","url":"https:\/\/rosettacode.org","logo":{"@type":"ImageObject","url":"https:\/\/static.miraheze.org\/rosettacodewiki\/d\/d3\/RosettaCodeTitle.png","caption":"Rosetta Code"}},"potentialAction":{"@type":"SearchAction","target":"https:\/\/rosettacode.org\/wiki\/Special:Search?search={search_term}","query-input":"required name=search_term"}}</script> <link rel="dns-prefetch" href="//login.miraheze.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Rosetta_Code page-Main_Page rootpage-Rosetta_Code 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-Social" class="vector-menu mw-portlet mw-portlet-Social" > <div class="vector-menu-heading"> Social </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-Discord" class="mw-list-item"><a href="https://discord.gg/JUAQDevqaH" rel="nofollow"><span>Discord</span></a></li><li id="n-Facebook" class="mw-list-item"><a href="https://www.facebook.com/rosettacode" rel="nofollow"><span>Facebook</span></a></li><li id="n-Twitter" class="mw-list-item"><a href="https://twitter.com/rosettacode" rel="nofollow"><span>Twitter</span></a></li> </ul> </div> </div> <div id="p-Explore" class="vector-menu mw-portlet mw-portlet-Explore" > <div class="vector-menu-heading"> Explore </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-Languages" class="mw-list-item"><a href="/wiki/Category:Programming_Languages"><span>Languages</span></a></li><li id="n-Tasks" class="mw-list-item"><a href="/wiki/Category:Programming_Tasks"><span>Tasks</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Load a random page [x]" accesskey="x"><span>Random page</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Rosetta_Code" class="mw-logo"> <img class="mw-logo-icon" src="https://static.miraheze.org/rosettacodewiki/c/c8/RosettaCodeTitle.ico" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <strong class="mw-logo-wordmark">Rosetta Code</strong> </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 Rosetta Code [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 Rosetta Code" aria-label="Search Rosetta Code" autocapitalize="sentences" title="Search Rosetta Code [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-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/wiki/Special:CreateAccount?returnto=Rosetta+Code" 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="/wiki/Special:UserLogin?returnto=Rosetta+Code" title="You are encouraged to log in; however, it is 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="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-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/wiki/Special:CreateAccount?returnto=Rosetta+Code" 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="/wiki/Special:UserLogin?returnto=Rosetta+Code" title="You are encouraged to log in; however, it is 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"><div id="mw-dismissablenotice-anonplace"></div><script>(function(){var node=document.getElementById("mw-dismissablenotice-anonplace");if(node){node.outerHTML="\u003Cdiv class=\"mw-dismissable-notice\"\u003E\u003Cdiv class=\"mw-dismissable-notice-close\"\u003E[\u003Ca tabindex=\"0\" role=\"button\"\u003Edismiss\u003C/a\u003E]\u003C/div\u003E\u003Cdiv class=\"mw-dismissable-notice-body\"\u003E\u003C!-- CentralNotice --\u003E\u003Cdiv id=\"localNotice\" data-nosnippet=\"\"\u003E\u003Cdiv class=\"sitenotice\" lang=\"en\" dir=\"ltr\"\u003E\u003Ctable class=\"messagebox\" style=\"text-align: center; background-color: lightblue; clear: both;\"\u003E\n\u003Ctbody\u003E\u003Ctr\u003E\n\u003Ctd\u003E\u003Ci\u003E\u003Ca rel=\"nofollow\" class=\"external text\" href=\"https://discord.gg/JUAQDevqaH\"\u003EJoin our Discord\u003C/a\u003E to discuss Rosetta Code!\u003C/i\u003E\n\u003C/td\u003E\u003C/tr\u003E\u003C/tbody\u003E\u003C/table\u003E\u003C/div\u003E\u003C/div\u003E\u003C/div\u003E\u003C/div\u003E";}}());</script></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">Beginning</div> </a> </li> <li id="toc-Places_to_start" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Places_to_start"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Places to start</span> </div> </a> <button aria-controls="toc-Places_to_start-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 Places to start subsection</span> </button> <ul id="toc-Places_to_start-sublist" class="vector-toc-list"> <li id="toc-Recently-Updated_Tasks" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Recently-Updated_Tasks"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.1</span> <span>Recently-Updated Tasks</span> </div> </a> <ul id="toc-Recently-Updated_Tasks-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Ways_to_Contribute" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Ways_to_Contribute"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2</span> <span>Ways to Contribute</span> </div> </a> <ul id="toc-Ways_to_Contribute-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Rosetta Code</span></h1> <div class="mw-indicators"> <div id="mw-indicator-smw-entity-examiner" class="mw-indicator"><div class="smw-entity-examiner smw-indicator-vertical-bar-loader" data-subject="Rosetta_Code#0##" data-dir="ltr" data-uselang="" title="Running an examiner in the background"></div></div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Rosetta_Code" title="View the content page [c]" accesskey="c"><span>Main Page</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Rosetta_Code" rel="discussion" class="mw-redirect" title="Discussion about the content page [t]" accesskey="t"><span>Discussion</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/Rosetta_Code"><span>Read</span></a></li><li id="ca-viewsource" class="vector-tab-noicon mw-list-item"><a href="/wiki/Rosetta_Code?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="/wiki/Rosetta_Code?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 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/Rosetta_Code"><span>Read</span></a></li><li id="ca-more-viewsource" class="vector-more-collapsible-item mw-list-item"><a href="/wiki/Rosetta_Code?action=edit"><span>View source</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/wiki/Rosetta_Code?action=history"><span>View history</span></a></li><li id="ca-purge" class="is-disabled mw-list-item"><a href="/wiki/Rosetta_Code?action=purge"><span>Refresh</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/Rosetta_Code" title="A list of all wiki pages that link here [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Rosetta_Code" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</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-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><li id="t-permalink" class="mw-list-item"><a href="/wiki/Rosetta_Code?oldid=368154" 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="/wiki/Rosetta_Code?action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/wiki/Special:CiteThisPage?page=Rosetta_Code&id=368154&wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/wiki/Special:UrlShortener?url=https%3A%2F%2Frosettacode.org%2Fwiki%2FRosetta_Code"><span>Get shortened URL</span></a></li><li id="t-smwbrowselink" class="mw-list-item"><a href="/wiki/Special:Browse/:Rosetta-5FCode" rel="search"><span>Browse properties</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 id="siteSub" class="noprint">From Rosetta Code</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"><p>Rosetta Code is a <a href="https://en.wikipedia.org/wiki/Chrestomathy" class="extiw" title="wp:Chrestomathy">programming chrestomathy</a> site. The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another. Rosetta Code currently has 1,304 <a href="/wiki/Category:Solutions_by_Programming_Task" title="Category:Solutions by Programming Task">tasks</a>, 383 <a href="/wiki/Category:Draft_Programming_Tasks" title="Category:Draft Programming Tasks">draft tasks</a>, and is aware of 954 <a href="/wiki/Category:Programming_Languages" title="Category:Programming Languages">languages</a>, though we do not (and cannot) have solutions to every task in every language. </p> <h2><span class="mw-headline" id="Places_to_start">Places to start</span></h2> <h3><span class="mw-headline" id="Recently-Updated_Tasks">Recently-Updated Tasks</span></h3> <p>See <a href="/wiki/Special:RecentChanges" title="Special:RecentChanges"> Recent Changes</a> </p> <h3><span class="mw-headline" id="Ways_to_Contribute">Ways to Contribute</span></h3> <table class="wikitable"> <tbody><tr> <td><a href="/wiki/Rosetta_Code:Village_Pump/Suggest_a_programming_task" title="Rosetta Code:Village Pump/Suggest a programming task"> Village Pump/Suggest a programming task</a> </td></tr> <tr> <td><a href="/wiki/Rosetta_Code:Village_Pump/Suggest_a_language" title="Rosetta Code:Village Pump/Suggest a language"> Village Pump/Suggest a language</a> </td></tr> <tr> <td><a href="/wiki/Rosetta_Code:Add_a_Language" title="Rosetta Code:Add a Language"> Add a Language</a> </td></tr> <tr> <td><a href="/wiki/Rosetta_Code:Add_a_Task" title="Rosetta Code:Add a Task"> Add a Task</a> </td></tr> <tr> <td><a href="/wiki/Help:Adding_a_new_programming_example" title="Help:Adding a new programming example"> Adding a new programming example</a> </td></tr> <tr> <td><a href="/wiki/Category:Examples_needing_attention" title="Category:Examples needing attention"> Examples needing attention</a> </td></tr> <tr> <td><a href="/wiki/Category:Unimplemented_tasks_by_language" title="Category:Unimplemented tasks by language"> Unimplemented tasks by language</a> </td></tr> </tbody></table> <!-- NewPP limit report Parsed by mw152 Cached time: 20241128115729 Cache expiry: 1296000 Reduced expiry: false Complications: [] [SMW] In鈥恡ext annotation parser time: 0.001 seconds CPU time usage: 0.019 seconds Real time usage: 0.026 seconds Preprocessor visited node count: 15/1000000 Post鈥恊xpand include size: 1320/2097152 bytes Template argument size: 0/2097152 bytes Highest expansion depth: 3/100 Expensive parser function count: 3/99 Unstrip recursion depth: 0/20 Unstrip post鈥恊xpand size: 0/5000000 bytes --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 12.522 1 -total 46.80% 5.861 1 Template:Mp_introduction 25.56% 3.200 1 Template:Mp_explore1 25.41% 3.182 1 Template:Mp_contribute1 --> <!-- Saved in parser cache with key rosettacodewiki:pcache:idhash:2-0!canonical and timestamp 20241128115729 and revision id 368154. Rendering was triggered because: page-view --> </div><noscript><img src="https://login.miraheze.org/wiki/Special:CentralAutoLogin/start?type=1x1" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://rosettacode.org/wiki/Rosetta_Code?oldid=368154">https://rosettacode.org/wiki/Rosetta_Code?oldid=368154</a>"</div></div> <div id="catlinks" class="catlinks catlinks-allhidden" data-mw="interface"></div> </div> </main> <div id='mw-data-after-content'> <div class="mw-cookiewarning-container"><div class="mw-cookiewarning-text"><span>Cookies help us deliver our services. By using our services, you agree to our use of cookies.</span></div><form method="POST"><div class='oo-ui-layout oo-ui-horizontalLayout'><span class='oo-ui-widget oo-ui-widget-enabled oo-ui-buttonElement oo-ui-buttonElement-framed oo-ui-labelElement oo-ui-flaggedElement-progressive oo-ui-buttonWidget'><a role='button' tabindex='0' href='https://meta.miraheze.org/wiki/Special:MyLanguage/Privacy_Policy#2._Cookies' rel='nofollow' class='oo-ui-buttonElement-button'><span class='oo-ui-iconElement-icon oo-ui-iconElement-noIcon oo-ui-image-progressive'></span><span class='oo-ui-labelElement-label'>More information</span><span class='oo-ui-indicatorElement-indicator oo-ui-indicatorElement-noIndicator oo-ui-image-progressive'></span></a></span><span class='oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-buttonElement oo-ui-buttonElement-framed oo-ui-labelElement oo-ui-flaggedElement-primary oo-ui-flaggedElement-progressive oo-ui-buttonInputWidget'><button type='submit' tabindex='0' name='disablecookiewarning' value='OK' class='oo-ui-inputWidget-input oo-ui-buttonElement-button'><span class='oo-ui-iconElement-icon oo-ui-iconElement-noIcon oo-ui-image-invert'></span><span class='oo-ui-labelElement-label'>OK</span><span class='oo-ui-indicatorElement-indicator oo-ui-indicatorElement-noIndicator oo-ui-image-invert'></span></button></span></div></form></div> </div> </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 28 November 2024, at 11:57.</li> <li id="footer-info-copyright">Content is available under GNU Free Document License 1.3 unless otherwise noted.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://meta.miraheze.org/wiki/Special:MyLanguage/Privacy_Policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Rosetta_Code:About">About Rosetta Code</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Rosetta_Code:General_disclaimer">Disclaimers</a></li> <li id="footer-places-termsofservice"><a href="https://meta.miraheze.org/wiki/Special:MyLanguage/Terms_of_Use">Terms of Use</a></li> <li id="footer-places-donate"><a href="https://meta.miraheze.org/wiki/Special:MyLanguage/Donate">Donate to Miraheze</a></li> <li id="footer-places-mobileview"><a href="https://rosettacode.org/wiki/Rosetta_Code?mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-poweredbyico"><a href="https://meta.miraheze.org/wiki/Special:MyLanguage/Miraheze_Meta" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="https://static.wikitide.net/commonswiki/f/ff/Powered_by_Miraheze.svg" alt="Hosted by Miraheze" width="88" height="31" loading="lazy"></a><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/1.43/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a><a href="https://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/1.43/extensions/SemanticMediaWiki/res/smw/assets/logo_footer.svg" alt="Powered by Semantic MediaWiki" class="smw-footer" width="88" height="31" loading="lazy"></a></li> <li id="footer-copyrightico"><a href="https://www.gnu.org/licenses/fdl-1.3.en.html" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="https://www.gnu.org/graphics/gfdl-logo-tiny.png" alt="GNU Free Document License 1.3" 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":"mw173","wgBackendResponseTime":190,"wgPageParseReport":{"smw":{"limitreport-intext-parsertime":0.001},"limitreport":{"cputime":"0.019","walltime":"0.026","ppvisitednodes":{"value":15,"limit":1000000},"postexpandincludesize":{"value":1320,"limit":2097152},"templateargumentsize":{"value":0,"limit":2097152},"expansiondepth":{"value":3,"limit":100},"expensivefunctioncount":{"value":3,"limit":99},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":0,"limit":5000000},"timingprofile":["100.00% 12.522 1 -total"," 46.80% 5.861 1 Template:Mp_introduction"," 25.56% 3.200 1 Template:Mp_explore1"," 25.41% 3.182 1 Template:Mp_contribute1"]},"cachereport":{"origin":"mw152","timestamp":"20241128115729","ttl":1296000,"transientcontent":false}}});});</script> <script> var _paq = window._paq = window._paq || []; if ( 1 ) { _paq.push(['disableCookies']); } if ( 0 ) { _paq.push(['setRequestMethod', 'GET']); } _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u = "https://analytics.wikitide.net/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setDocumentTitle', "rosettacodewiki" + " - " + "Rosetta Code"]); _paq.push(['setSiteId', 6510]); _paq.push(['setCustomVariable', 1, 'userType', "Anonymous", "visit"]); if ( 1 ) { _paq.push(['addTracker', u + 'matomo.php', 1]); } var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script> <noscript><p><img src="https://analytics.wikitide.net/matomo.php?idsite=6510&rec=1&action_name=Rosetta_Code" style="border:0;" alt="" /></p></noscript> </body> </html>