{"id":85,"date":"2024-09-26T12:13:07","date_gmt":"2024-09-26T11:13:07","guid":{"rendered":"http:\/\/monkey.ploogie.co.uk\/?page_id=85"},"modified":"2024-09-28T10:25:50","modified_gmt":"2024-09-28T09:25:50","slug":"mwnci-assert-function","status":"publish","type":"page","link":"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-assert-function\/","title":{"rendered":"Mwnci assert() Function"},"content":{"rendered":"<h1>Syntax<\/h1>\n<p>assert(expr,[msg])<\/p>\n<h2>Parameters<\/h2>\n<p>&nbsp;<\/p>\n<table class=\"confluenceTable tablesorter tablesorter-default\" style=\"height: 256px;\" width=\"505\">\n<tbody>\n<tr class=\"tablesorter-headerRow\">\n<th class=\"confluenceTh sortableHeader tablesorter-headerAsc\" data-column=\"0\">\n<div class=\"tablesorter-header-inner\">Parameter<\/div>\n<\/th>\n<th class=\"confluenceTh sortableHeader\" data-column=\"1\">\n<div class=\"tablesorter-header-inner\">Definition<\/div>\n<\/th>\n<\/tr>\n<tr>\n<td class=\"confluenceTd\"><em>expr<\/em><\/td>\n<td class=\"confluenceTd\"><em>true\/false <\/em>result of a test<\/td>\n<\/tr>\n<tr>\n<td class=\"confluenceTd\"><em>msg<\/em><\/td>\n<td class=\"confluenceTd\">Optional message to display for an assertion failure when the result is <em>false<\/em>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Description<\/h2>\n<p>The <em>assert()<\/em> function exits the program immediately with a non-zero status if <em>expr<\/em> is false optionally displaying <em>msg<\/em> to standard error.<\/p>\n<p><em>assert()<\/em> is used when debugging code.<\/p>\n<p><em>assert()<\/em> lets you test if a condition in your code returns True, if not, the program will raise an AssertionError.<\/p>\n<h2>Example<\/h2>\n<p>x=&#8221;goodbye&#8221;<br \/>\nassert(x == &#8220;hello&#8221;, &#8220;x should equal &#8216;goodbye&#8217;\\n&#8221;)<\/p>\n<p>Assertion Error: x should equal &#8216;goodbye&#8217;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Syntax assert(expr,[msg]) Parameters &nbsp; Parameter Definition expr true\/false result of a test msg Optional message to display for an assertion failure when the result is false. Description The assert() function exits the program immediately with a non-zero status if expr is false optionally displaying msg to standard error. assert() is used when debugging code. assert() &hellip; <a href=\"https:\/\/monkey.ploogie.co.uk\/index.php\/mwnci-assert-function\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mwnci assert() 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-85","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/85","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=85"}],"version-history":[{"count":4,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/85\/revisions"}],"predecessor-version":[{"id":120,"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/85\/revisions\/120"}],"wp:attachment":[{"href":"https:\/\/monkey.ploogie.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}