Variables

Revision as of 06:26, 22 June 2021 by MacroDroidDev (talk | contribs)

Variables can be used to store values (numbers, text strings and true/false conditions). These values can be set in the Set Variable Action. Variables can be used throughout the app as Triggers and Conditions, and can be used for controlling specific Macrodroid and system settings.

Global Variables

Global variables are available throughout the application from any Macro. You should use global variables when you need to store a value between more than a single macro. The list of global variables can be accessed via the Variables tile on the home screen. From this screen you can add, delete and change the value of a global variable.

Local Variables

Local variables are specific to an individual macro. You should use a local variable when the value is only required in that individual macro. Local variables are accessed via the edit macro screen.

Variable Types

A variable can belong to 1 of the 4 following types: Boolean, Integer, Decimal or String.

  • Boolean type allows 2 states: True or False
  • Integer type is to store positive or negative numbers without decimal part, in order to make any kind of mathematical calculations or comparison.
  • Decimal type is to store any positive or negative numeric value, with or without decimal digits, in order to make any kind of mathematical calculations or comparison
  • String type contains any kind of character (alphanumeric ones or any special ones, such as line feed/carriage return/new line or emojis). HINT: an individual string variable can hold up to 500,000 characters, however it is advisable to avoid very long strings where possible. If you should use strings of great length it is recommended to clear them when finished with.