{"id":775,"date":"2022-09-07T15:15:39","date_gmt":"2022-09-07T13:15:39","guid":{"rendered":"https:\/\/support.botnation.ai\/increment-decrement-the-value-of-a-variable\/"},"modified":"2026-01-02T16:34:44","modified_gmt":"2026-01-02T15:34:44","slug":"increment-decrement-the-value-of-a-variable","status":"publish","type":"support","link":"https:\/\/botnation.ai\/en\/support\/increment-decrement-the-value-of-a-variable\/","title":{"rendered":"Increment \/ Decrement the value of a variable"},"content":{"rendered":"<p>This feature allows you to increase or decrease the value of a variable with each pass over the sequence.<\/p>\n\n\n\n<p>If the concept of a variable is totally abstract for you, I advise you to consult the following article before continuing: <a href=\"https:\/\/botnation.ai\/en\/support\/all-about-variables\/\">All about {{\u2026}} variables<\/a>.<\/p>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">1. Use<\/h2>\n\n\n\n<p>Among the construction features, click on \u201cVariables\u201d and then, in the menu that opens, click on \u201cIncrement\u201d or \u201cDecrement\u201d.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/Crementer_00_UK-1024x604.png.webp\" alt=\"\" class=\"wp-image-779\"><\/figure>\n\n\n\n<p>Let\u2019s create a new sequence with an <strong><em>Increment<\/em><\/strong> feature.<br>We will choose the variable<em>\u201cmyVariable\u201d <\/em>and put in the value field the value 2.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-124.png.webp\" alt=\"\" class=\"wp-image-781\"><\/figure>\n<\/div>\n\n\n<p>When the bot executes this function, it will add 2 to the <a href=\"https:\/\/botnation.ai\/en\/assign-a-value-to-a-variable\/\">value of the\u201dmyVariable\u201d variable<\/a><\/p>\n\n\n\n<p>Let\u2019s check the result with the help of a <a href=\"https:\/\/botnation.ai\/en\/support\/add-a-text-to-your-chatbot\/\">Text feature<\/a>:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-125.png.webp\" alt=\"\" class=\"wp-image-783\"><\/figure>\n<\/div>\n\n\n<p>Let\u2019s run the bot to see the result:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-126.png.webp\" alt=\"\" class=\"wp-image-785\"><\/figure>\n<\/div>\n\n\n<p>In this example myVariable initially had the value 5. The value of the variable has changed, it is now 7 (5+2).<\/p>\n\n\n\n<p>The logic of the <strong><em>Decrement<\/em><\/strong> feature is identical except that instead of adding a value, we subtract it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Options<\/h2>\n\n\n\n\n","protected":false},"featured_media":0,"template":"","meta":{"_acf_changed":false},"categorie-support":[183,193,194,185,171,221],"class_list":["post-775","support","type-support","status-publish","hentry","categorie-support-chatbot-web","categorie-support-facebook-messenger-en","categorie-support-features","categorie-support-fonctionnalites","categorie-support-variables","categorie-support-web-chatbot-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/support\/775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/support"}],"about":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/types\/support"}],"wp:attachment":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/media?parent=775"}],"wp:term":[{"taxonomy":"categorie-support","embeddable":true,"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/categorie-support?post=775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}