Variable types used in Shortcuts
Shortcuts lets you create variables automatically or manually.
In every shortcut, each action’s output is automatically available as a Magic Variable. Unlike manual variables, Magic Variables don’t require you to save the output of an action for later use — simply tap the Magic Variable button and select the output of any action to use it as a variable.
Using Magic Variables, you can switch to a special view of the shortcut editor that shows all the outputs of actions in your shortcut as selectable variables. A later action can take input from the output of a previous action. Magic Variables are visually useful as well, displaying the icon of the action from which they’re generated.
Making the variables truly magic, however, is your ability to change the variable type — simply tap a Magic Variable to change its format and to specify which of its details to use. For more information, see Adjust variables in Shortcuts.
In most cases, using Magic Variables simplifies building shortcuts and is preferable to manually creating variables.
You can add manual variables to a shortcut using the Set Variable action or the Add to Variable action.
Set Variable allows you to set a new variable for the first time or overwrite a previously stored variable.
Add to Variable allows you to add multiple pieces of content to the same variable by appending to the variable each time the shortcut runs, storing the data as an ordered list.
Setting variables manually tends to lengthen shortcuts and make them harder to read. In most cases, manual variables are unnecessary — Magic Variables do much of the same work more concisely. For example, you can replicate most of the Add to Variable functionality by placing variables into a List action and retrieving the variables later.
For step-by-step information about adding variables to your shortcuts, see Use variables in Shortcuts.