{"id":253,"date":"2024-10-01T21:37:37","date_gmt":"2024-10-01T20:37:37","guid":{"rendered":"http:\/\/monkey.ploogie.co.uk\/?page_id=253"},"modified":"2024-10-02T04:10:57","modified_gmt":"2024-10-02T03:10:57","slug":"mwnci-variables","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-variables\/","title":{"rendered":"Mwnci Variables"},"content":{"rendered":"<h2>Creating Variables<\/h2>\n<p>Mwnci doesn&#8217;t have a specific command for declaring variables.<\/p>\n<p>A variable is created as soon as it has been assigned a value.<\/p>\n<pre><span class=\"pythoncolor\">x = <span class=\"pythonnumbercolor\">10<\/span>\r\ny = <span class=\"pythonstringcolor\">\"Vimes\"<\/span>\r\n<span class=\"pythonkeywordcolor\">print<\/span>(x)\r\n<span class=\"pythonkeywordcolor\">print<\/span>(y)\r\n<\/span><\/pre>\n<p>Also variables do not have to be declared as any particular type and can have the type changed after they have been set<\/p>\n<pre>x = 100          \/\/ integer\r\nx = \"Carrot\"     \/\/ string\r\nprintln(x)\r\n\r\n\r\nCarrot<\/pre>\n<h2>Casting<\/h2>\n<p>You can specify the type of a variable using casting<\/p>\n<pre><span class=\"pythoncolor\">a = <span class=\"pythonkeywordcolor\">int<\/span>(<span class=\"pythonnumbercolor\">3<\/span>)\u00a0\u00a0\u00a0    \/\/<span class=\"commentcolor\"> a will be 3\r\n<\/span>b = <span class=\"pythonkeywordcolor\">float<\/span>(<span class=\"pythonnumbercolor\">a<\/span>)     \/\/<span class=\"commentcolor\"> b will be 3.0 \r\nc = <span class=\"pythonkeywordcolor\">string<\/span>(<span class=\"pythonnumbercolor\">a<\/span>)\u00a0\u00a0\u00a0 \/\/ c will be \"3\"\r\n<\/span><\/span><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating Variables Mwnci doesn&#8217;t have a specific command for declaring variables. A variable is created as soon as it has been assigned a value. x = 10 y = &#8220;Vimes&#8221; print(x) print(y) Also variables do not have to be declared as any particular type and can have the type changed after they have been set &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-variables\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci Variables&#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-253","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/253","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=253"}],"version-history":[{"count":4,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/253\/revisions"}],"predecessor-version":[{"id":257,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/253\/revisions\/257"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}