{"id":22133,"date":"2022-09-07T15:15:39","date_gmt":"2022-09-07T13:15:39","guid":{"rendered":"https:\/\/botnation.ai\/support\/increment-decrement-the-value-of-a-variable-2\/"},"modified":"2026-02-25T23:04:45","modified_gmt":"2026-02-25T22:04:45","slug":"increment-decrement-the-value-of-a-variable-2","status":"publish","type":"support","link":"https:\/\/botnation.ai\/en\/support\/increment-decrement-the-value-of-a-variable-2\/","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 each time the sequence is run.<\/p>\n\n<p>If the concept of a variable is totally abstract for you, I suggest you consult the following article before continuing: <a href=\"https:\/\/botnation.ai\/en\/support\/everything-you-need-to-know-about-variables\/\">All about {{\u2026}} variables<\/a>.<\/p>\n\n<h2 class=\"wp-block-heading\">1. Use<\/h2>\n\n<p>Among the construction functions, click on \u201cVariables\u201d then, in the menu that opens, click on \u201cIncrement\u201d or \u201cDecrement\u201d.<\/p>\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/Crementer_00_FR-1024x604.png.webp\" alt=\"\" class=\"wp-image-766\"><\/figure>\n\n<p>Let\u2019s create a new sequence with <strong><em>Increment<\/em><\/strong>.<br>We\u2019ll choose the variable<em>\u201cmyVariable\u201d <\/em>and set the value in the value field to 2.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"304\" height=\"176\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-121.png.webp\" alt=\"\" class=\"wp-image-768\" srcset=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-121.png 304w, https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-121-300x174.png 300w\" sizes=\"(max-width: 304px) 100vw, 304px\" \/><\/figure>\n<\/div>\n<p>When the bot executes this function, it will add 2 to the value of the variable<em>\u201cmyVariable<\/em>\u201c.<\/p>\n\n<p>Let\u2019s check the result with a <a href=\"https:\/\/botnation.ai\/en\/support\/add-text-to-your-chatbot\/\">Text feature<\/a>:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"480\" height=\"433\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-122.png.webp\" alt=\"\" class=\"wp-image-770\" srcset=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-122.png 480w, https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-122-300x271.png 300w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/figure>\n<\/div>\n<p>Let\u2019s run the bot to see the result:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"313\" height=\"35\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-123.png.webp\" alt=\"\" class=\"wp-image-772\" srcset=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-123.png 313w, https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-123-300x34.png 300w\" sizes=\"(max-width: 313px) 100vw, 313px\" \/><\/figure>\n<\/div>\n<p>In this example, myVariable was initially set to 5. The value of the variable has now changed to 7 (5+2).<\/p>\n\n<p>The logic of functionality <strong><em>Decrement<\/em><\/strong> function is identical, except that instead of adding a value, we subtract it.<\/p>\n\n<h2 class=\"wp-block-heading\">2. Options<\/h2>\n","protected":false},"featured_media":0,"template":"","meta":{"_acf_changed":false},"categorie-support":[194,222,221],"class_list":["post-22133","support","type-support","status-publish","hentry","categorie-support-features","categorie-support-variables-en","categorie-support-web-chatbot-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/support\/22133","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=22133"}],"wp:term":[{"taxonomy":"categorie-support","embeddable":true,"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/categorie-support?post=22133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}