{"id":13276,"date":"2026-01-07T18:48:47","date_gmt":"2026-01-07T17:48:47","guid":{"rendered":"https:\/\/botnation.ai\/support\/assigning-a-value-to-a-variable\/"},"modified":"2026-01-07T18:49:05","modified_gmt":"2026-01-07T17:49:05","slug":"assigning-a-value-to-a-variable","status":"publish","type":"support","link":"https:\/\/botnation.ai\/en\/support\/assigning-a-value-to-a-variable\/","title":{"rendered":"Assigning a value to a variable"},"content":{"rendered":"<p>The functionality <strong><em>Assign<\/em><\/strong> function lets you create and modify a variable.<\/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\/fr\/support\/tout-savoir-sur-les-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 \u201cAssign\u201d.<\/p>\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/Affecter_00_FR-1024x604.png.webp\" alt=\"\" class=\"wp-image-732\"><\/figure>\n\n<p>Let\u2019s start by creating a function <strong><em>Assign<\/em><\/strong> :<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"479\" height=\"134\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-113.png.webp\" alt=\"\" class=\"wp-image-734\" srcset=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-113.png 479w, https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-113-300x84.png 300w\" sizes=\"(max-width: 479px) 100vw, 479px\" \/><\/figure>\n<\/div>\n<p>You have 2 choices:<\/p>\n\n<ul class=\"wp-block-list\">\n<li>Select 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<p>All you have to do is insert the value to be assigned to the variable.<br>When the bot executes this function, it will be completely invisible to the user.<\/p>\n\n<p>It is also possible to give the variable the value of another existing variable by clicking on the <strong>{\u2026}<\/strong> icon.<\/p>\n\n<p>We have created a variable with the name<em>\u201cmyVariable\u201d<\/em> and the value<em>\u201c5\u201d:<\/em><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"466\" height=\"129\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-114.png.webp\" alt=\"\" class=\"wp-image-736\" srcset=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-114.png 466w, https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-114-300x83.png 300w\" sizes=\"(max-width: 466px) 100vw, 466px\" \/><\/figure>\n<\/div>\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<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"477\" height=\"394\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-115.png.webp\" alt=\"\" class=\"wp-image-738\" srcset=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-115.png 477w, https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-115-300x248.png 300w\" sizes=\"(max-width: 477px) 100vw, 477px\" \/><\/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 loading=\"lazy\" decoding=\"async\" width=\"257\" height=\"32\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-116.png.webp\" alt=\"\" class=\"wp-image-740\"><\/figure>\n<\/div>\n<p>It\u2019s confirmed: our \u201cmyVariable\u201d variable has the value 5. We can now manipulate it from any sequence in our bot. <\/p>\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 to 0 a variable that has already been filled,<\/strong> simply enter the name of the variable and set the value to empty.<\/p>\n<\/blockquote>\n\n<h2 class=\"wp-block-heading\">2. Options<\/h2>\n\n<p>A \u2013 You can leave your colleagues a comment about this feature by clicking on the icon (see below).<br>See article : <a href=\"https:\/\/botnation.ai\/fr\/support\/ajouter-des-commentaires\/\">Adding comments<\/a><\/p>\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/08\/Texte_06_FR-1-1024x604.png.webp\" alt=\"Add a comment\" class=\"wp-image-98\"><\/figure>\n\n<p>B \u2013 By clicking on the \u201c?\u201d icon, the online help will open on the article corresponding to this feature.<\/p>\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/08\/Texte_08_FR-1024x604.png.webp\" alt=\"Online help\" class=\"wp-image-100\"><\/figure>\n\n<p>C \u2013 You can duplicate, delete or move this feature by using the icons that appear when you hover over it.<\/p>\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/08\/Texte_07_FR-1-1024x604.png.webp\" alt=\"Move, duplicate and delete functionality\" class=\"wp-image-102\"><\/figure>\n","protected":false},"featured_media":0,"template":"","meta":{"_acf_changed":false},"categorie-support":[194,222,221],"class_list":["post-13276","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\/13276","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=13276"}],"wp:term":[{"taxonomy":"categorie-support","embeddable":true,"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/categorie-support?post=13276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}