A variable is a snippet of text that can be accessed by name within a particular branch of the widget tree. The snippet is known as the variable's value.
A new variable is defined using a
$set widget, and is then available to any of the children of that widget, including transcluded content. A
$set widget can reuse an existing name, thus binding a different snippet to that name for the duration of the widget's children.
$list widget also sets a particular variable (
currentTiddler by default) to each listed title in turn.
For an overview of how to use variables, see Variables in WikiText.
Despite the term "variable", each snippet is a constant string. The apparent variability is actually the result of the presence of multiple variables with the same name in different parts of the widget tree.
Macros are a special form of variable whose value can contain placeholders that get filled in with parameters whenever the macro is used.
By themselves, the snippets are not parsed as WikiText. However, a variable reference will transclude a snippet into a context where WikiText parsing may be occurring. Within a snippet, the only markup detected is
$name$ for a macro parameter transclusion and
$(name)$ for a variable transclusion.
dumpvariables macro lists all variables (including macros) that are available at that position in the widget tree.
TiddlyWiki's core has several variables built in.