Variables
In this section, we will explore the concept of Variables.
What is a Variable?
A variable is like a box that can hold data. In programming, we use variables to store various types of data, such as numbers, text, boolean values, and more. You can think of a variable as the name of a box, and by using this name, you can add data to the box or retrieve data from it.
Benefits of Variables
Variables are an essential part of programming languages. They provide a means to store, manipulate, and manage data, making programs more flexible, readable, and maintainable. For this reason, Tapicker also offers the concept of variables.
Characteristics of Variables
Variables must be defined before they can be used. Once defined, a variable can be read and modified. When a variable is no longer needed, it is automatically destroyed to free up memory.
- Variable Name: Used to identify the variable, usually composed of letters, numbers, and underscores.
- Data Type: Variables can store different types of data, such as integers, floating-point numbers, strings, boolean values, etc.
- Value: The data stored in the variable is its value.
- Scope: The range within which the variable is effective, i.e., where in the code the variable can be accessed.
💡 Note:
In Tapicker: Variable names are flexible; they can include any characters except forspaces
,[]
, and{{}}
.
Scope: For ease of use, all variables in Tapicker are global.
Defining Variables
Defining a variable is straightforward. For detailed instructions, please refer to the Set Variables section.
Accessing Variables
We provide a specialized syntax for accessing variables. For details, please see the Template Syntax section.
Example
If you define a variable called Foo
, you can access it in any block using {{@vars.Foo}}
.