This page is part of a static HTML representation of the TiddlyWiki at


 26th April 2015 at 11:59am


The $vars widget allows multiple variables to be set in one operation. In some situations it can result in simpler code than using the more flexible $set widget. It differs from the $let in that variables cannot interfere with the evaluation of other variables within the same $vars.

Content and Attributes

The content of the $vars widget is the scope for the value assigned to the variable.

{attributes not starting with $}Each attribute name specifies a variable name. The attribute value is assigned to the variable

Attributes will not interfere with the evaluation of other attributes. So if one attribute sets currentTiddler, and another attribute uses currentTiddler in its evaluation, it will use the value of currentTiddler that exists outside the widget's scope.


Consider a case where you need to set multiple variables.

Using the $vars widget, this situation may be handled in the following way:

\define helloworld() Hello world!

<$vars greeting="Hi" me={{!!title}} sentence=<<helloworld>>>
  <<greeting>>! I am <<me>> and I say: <<sentence>>

In contrast, here is the same example using the $set widget:

<$set name="greeting" value="Hi" >
<$set name="me" value={{!!title}} >
<$set name="sentence" value=<<helloworld>> >
  <<greeting>>! I am <<me>> and I say: <<sentence>>


It should be noted that this widget differs from the $set widget in the following ways:

  • A fallback (also known as "emptyValue") cannot be specified
  • Filters cannot be used to produce a conditional variable assignment
  • Variable names must be literal strings