This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

Functions

 19th April 2023 at 10:31am

Introduction

New in v5.3.0 A function is a named snippet of text containing a Filter Expression. Functions can have named parameters which are available within the function as variables.

Functions are usually defined with the Pragma: \function:

\function my-function(parameter:"2")
[<parameter>multiply[1.5]]
\end

Functions can be invoked in several ways:

  • Directly transclude functions with the syntax <<myfn param:"value">>
  • Assign functions to widget attributes with the syntax <div class=<<myfn param:"value">>>
  • Invoke functions via the function Operator with the syntax [function[myfn],[value],...]
  • Directly invoke functions whose names contain a period as custom filter operators with the syntax [my.fn[value]] or [.myfn[value]]

How Functions Work

Functions are implemented as a special kind of variable. The only thing that distinguishes them from ordinary variables is the way that the parameters are handled.