Skip to main content
MindTouch Success Center

Work with DekiScript variables

This page applies to:MindTouch (current)

This article provides basic instructions on how to work with DekiScript variables to help you manage your MindTouch content. Learn how to assign values to variables in DekiScript.


Assign a value to a variable


Use the following syntax to assign a value to a variable:

  1. Add a DekiScript block to a  page.
  2. Type the following code into the DekiScript block:
var x=5;

Explanation of the syntax 

Syntax element Description
var The keyword defines the variable statement
x  The letter chosen as the variable
= The operator designating that the variable is to be assigned a value
5  The value assigned to the variable
; The operator indicating the end of a line of code (necessary)

You will not be able to see the value unless you reference the variable.

 

Example


If you wanted to show the number 56,  you could do so by assigning two unique values to two variables. You can, for example, assign a value of 5 to the variable x  and assign a value of 6 to the variable y and then concatenate (chain together) the two variables to create a string of text:

  1. Add a DekiScript block to a  page.
  2. Type the following code into the DekiScript block:
var x=5;
var y=6;
""..x..""..y.."";

Explanation of the syntax 

Syntax element Description
var x=5 Assigns the value of 5 to the variable x
var y=6 Assigns the value of 6 to the variable y
"" Open and end quotes to designate the beginning and ending of a string of text
"..x.."  Calls the variable x (the quotes call the variable as a string of text)
"..y.."  Calls the variable y (the quotes call the variable as a string of text)
.. The operator surrounding the variables x and y to ensure  that text before and after is concatenated (chained together) 
; The operator indicating the end of a line of code (necessary)
  1. Once you click Save, you will see:
56


What's  next?


Learn how to work with DekiScript objects.

  • Was this article helpful?