caption: Variables created: 20141002141231992 modified: 20150107121000000 tags: WikiText title: Variables in WikiText type: text/vnd.tiddlywiki \define tags() {{!!tags}} [[Variables]] contain values. They are available within the scope of the [[widget|Widgets]] in which they are defined, as well as all child widgets in the widget tree. !!Defining Variables Variables are defined by... ; [[Macros|Macros in WikiText]] : in fact, variables are macro shorthands (see example below) ; SetWidget : sets a variable to a value ; ListWidget : sets list-item and iterator variabes ; TiddlyWiki : in the core and core templates !!Using Variables Variables are used via... ; shorthand :`<>` ; variable substitution within [[macros|Macros]] :`$(variableName)$` ; as variable operands in [[filter expressions|Introduction to Filters]] : `[operator]` ; in [[widgets|Widgets]] : internally, or as widget attributes : `<$edit tiddler=<>/>` !! Examples ''defining a variable via SetWidget'' ``` <$set name=foo value=bar> <> ``` <<< <$set name=foo value=bar> <> <<< ''a variable is a macro'' Below, the `\define` pragma at the beginning of a tiddler [[defines the macro|Macros in WikiText]] `<>`, valid in the scope of the CurrentTiddler, returning the value of the standard `tags` field. ``` \define tags() {{!!tags}} <> ``` <<< <> <<< ''using a filter variable to get all incoming links'' Using the [[backlinks|FilterOperator: backlinks]] [[filter operator|FilterOperators]] to get all tiddlers linking to this one... ``` <backlinks[]]">> ``` <<< <backlinks[]]">> <<<