Mindscript

Perform basic operations on your variables

Overview

Mindscript is a simple way to perform basic operations on the variables in your videos. Using the liquid syntax shown on the Variables page, you can easily increment and decrement numerical variables and concatenate string variables. Mindscript supports the + and - operators to increment and decrement numbers and the + operator to join strings.

Syntax

As mentioned above, the + and - operators are supported in the Mindscript syntax. In order to use these operators, simply apply them directly within the curly braces {{ }} wherever you use variables.

Numerical Operations

+ and - can be used for numerical operations to add and subtract numbers. For example, if you have a variable called counter that was initially set to 0 and you wanted to increment counter throughout the video, you could use the syntax {{counter + 1}} to do so. Similarly, {{counter - 1}} would decrease counter. Operations can be chained as well. Meaning the expression {{counter + 1 - myNumber}} is a valid statement.

❗️

Note

At this time, + and - are the only supported operators, meaning that the following operators are NOT supported: * / % ^ ( ) { } [ ]

String Operations

+ can be used for string concatenation. For example, if you have the variables first and last set to John and Doe, respectively, then you can perform the operation {{ first + last }} to get the full name of JohnDoe. Since there is no space between first and last, there will not be a space in the output. To get a space the syntax {{ first + " " + last }} should be used.

Considerations

  • If you are trying to operate on multiple variables, be sure that they are all either strings or numbers. If you try to add a number and a string, the result will be a string concatenation. For example, {{ counter + first}} will return 0John.
  • All operations are performed right to left. {{5 + 1 - 4}} = 2 and {{first + 10 + 4}} = John104
  • A variable that is not set will result in an empty result. {{first + " " + middle + " " + last}} would return John Doe since middle was not defined. Similarly, if you are doing a mathematical operation and a variable is not defined, it will default to 0.
  • Subtraction on a string variable will not be calculated. {{first + 10 - 4 + 2}} = John102. This is because first + 10 = John10 the - 4 is ignored, and then the + 2 is added to John10 resulting in John102.

Example of Mindscript in Action

📘

Get in Touch

Need help or want to know more about Mindscript? We're here for you! Contact [email protected] to get help using Mindscript in your videos or to learn more about what's possible.