Variable Nodes

In this chapter, we will learn about variable nodes. We already discussed about function nodes in the "Understanding nodes" chapter. This chapter will solely focus on variable nodes

1. Creating a Variable

To create a variable, click on the "Variable" section in your sidebar

You will see a list with four variable types.

  1. Integers : Where integer (numeric values) are stored. For example, the age of a student, or the student ID

  2. Strings : Where string values (Alphabets or words) are stored. For example, the name of the student, or the password of the user

  3. Booleans : This is where boolean values (True or false) conditions are stored. For example, permissions or flags.

  4. Floats : Where Floating point values (Numbers with decimals) are stored. For example, value of Pi (3.14).

In order to create a variable, select the type of variable from the dropbox, and click on the Add button. The variable will be created and stored in the program.

2. Using a Variable

Now that you have created the variable, it will appear in the variable list. Click on the variable you have created to add it to your program

Notice this variable does not have any input or output points. That is because Variable nodes dont determine the flow of program, they only exist to set data or receive data

The "set" inputX point is used to set the value of variable. Then use the textbox to set the value of your integer. Connect it to any node's output-X point

Here, the value "5" is being set in the variable

The "get" outputX point is used to get or fetch the value of the variable.

Here, the value "0" is being fed into the print node

3. Storing user input in a Variable :

In this example, you can take the user input value and store it in a value. In this scenario, a string variable is used. You can also use an integer variable.

Once you have stored the value, you can re-use that value somewhere else. For instance :

The "Route" node is used to redirect the connection to another node. It is used to keep programs clean and readable.

Here, the name variable is fed into the Print Node, which gives the result :

Similiarly, you can also store the output of an arithemetic operation in a variable node

Last updated