The Set-Variable Action allows you to create a variable within your task using two values. This is useful, since you can use this value to manipulate or change the logic of other actions. The first value of the action is the name of the variable you want to create, and is used to reference it when you want it implemented in other actions. The second value is the value that the variable is set to, which can be output relays, numerical values, other variables, etc.

Global Variable

When creating a variable to use in Tasker, you can make the variable global. This will allow you to use this variable in other tasks where it wasn't declared in. To make a variable global, you simply add two $$ before the name of the variable like in the example picture above.