{"id":266,"date":"2024-10-03T07:59:59","date_gmt":"2024-10-03T06:59:59","guid":{"rendered":"http:\/\/monkey.ploogie.co.uk\/?page_id=266"},"modified":"2024-10-03T07:59:59","modified_gmt":"2024-10-03T06:59:59","slug":"mwnci-insert-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-insert-function\/","title":{"rendered":"Mwnci insert() Function"},"content":{"rendered":"<h2><span id=\"Syntax\" class=\"mw-headline\">Syntax<\/span><\/h2>\n<p>insert(<i><b>array<\/b><\/i>, <i><b>index<\/b><\/i>, <i><b>value<\/b><\/i>)<\/p>\n<h2><span id=\"Description\" class=\"mw-headline\">Description<\/span><\/h2>\n<p>The <i>insert()<\/i> function inserts the specified value at the specified position. If the array has no content or the index specified is outside the range of the length of the array, then the function will fail.<\/p>\n<h2><span id=\"Example\" class=\"mw-headline\">Example<\/span><\/h2>\n<pre>a=[]\r\na=push(a, 100)\r\nprintln(a)\r\na=insert(a, 0, 200)\r\nprintln(a)\r\n\/\/ This should give an out of range error\r\na=insert(a, 2, \"Fred\")\r\n\r\n\r\n[100]\r\n[200, 100]\r\nError calling `insert`\u00a0: ERROR: IndexError: Array index [2] out of range\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Syntax insert(array, index, value) Description The insert() function inserts the specified value at the specified position. If the array has no content or the index specified is outside the range of the length of the array, then the function will fail. Example a=[] a=push(a, 100) println(a) a=insert(a, 0, 200) println(a) \/\/ This should give an &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-insert-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci insert() Function&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-266","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/266","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=266"}],"version-history":[{"count":1,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/266\/revisions"}],"predecessor-version":[{"id":267,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/266\/revisions\/267"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}