{"id":743,"date":"2022-09-07T14:56:58","date_gmt":"2022-09-07T12:56:58","guid":{"rendered":"https:\/\/support.botnation.ai\/assign-a-value-to-a-variable\/"},"modified":"2026-01-02T16:34:44","modified_gmt":"2026-01-02T15:34:44","slug":"assign-a-value-to-a-variable","status":"publish","type":"support","link":"https:\/\/botnation.ai\/en\/support\/assign-a-value-to-a-variable\/","title":{"rendered":"Assign a value to a variable"},"content":{"rendered":"<p>The <strong><em>Set<\/em><\/strong> feature allows us to create as well as modify a variable.<\/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 \u201cSet\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\/Affecter_00_UK-1024x604.png.webp\" alt=\"Set feature - Icon\" class=\"wp-image-747\"><\/figure>\n\n\n\n<p>Let\u2019s start by creating a <strong><em>Set<\/em><\/strong> feature:<\/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-117.png.webp\" alt=\"Set feature\" class=\"wp-image-749\"><\/figure>\n<\/div>\n\n\n<p>You have 2 choices:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Choose an existing variable from the drop-down list to modify it.<\/li>\n\n\n\n<li>Create a variable by inserting the name of the new variable.<\/li>\n<\/ul>\n\n\n\n<p>All you have to do is insert the value to be assigned to the variable.<br>When the bot performs this function, it will be completely invisible to the user.<\/p>\n\n\n\n<p>It is also possible to give the variable the value of another existing variable by clicking on the icon <strong>{\u2026}<\/strong><\/p>\n\n\n\n<p>We have created a variable with the name<em>\u201cmyVariable\u201d<\/em> and the value<em>\u201c5\u201d:<\/em><\/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-118.png.webp\" alt=\"Set feature\" class=\"wp-image-751\"><\/figure>\n<\/div>\n\n\n<p>Let\u2019s check that the operation works by asking the bot to display the value of the variable <em>myVariable<\/em>.<\/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-119.png.webp\" alt=\"Set feature\" class=\"wp-image-753\"><\/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-120.png.webp\" alt=\"\" class=\"wp-image-756\"><\/figure>\n<\/div>\n\n\n<p>It is confirmed, our variable \u201cmyVariable\u201d has the value 5. We can now manipulate it from any sequence in our bot.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>TIP<\/strong><br><strong>To reset a variable already filled to 0,<\/strong> just put the name of the variable and as value put empty.<\/p>\n<\/blockquote>\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-743","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\/743","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=743"}],"wp:term":[{"taxonomy":"categorie-support","embeddable":true,"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/categorie-support?post=743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}