이 문서는 https://tiddlywiki.com/languages/ko-KR/에서 티들리위키의 정적 HTML 표현의 일부입니다

Pragma: \function

2023년 4월 19일 오전 10:31

New in v5.3.0 The \function pragma is used to define custom functions. It is a shortcut syntax for the SetVariableWidget.

The usual form allows custom functions to span multiple lines:

\function <function-name>(<param-name>[:<param-default-value>],<param-name>[:<param-default-value>]...)
<multiple-line-definition-text>
\end [<function-name>]

Note that the \end marker can optionally specify the name of the function to which it relates, enabling function definitions to be nested inside procedures, macros or widget definitions.

There is also a single line form for shorter functions:

\function <function-name>(<param-name>[:<param-default-value>],<param-name>[:<param-default-value>]...) <single-line-definition-text>

The first line of the definition specifies the function name and any parameters. Each parameter has a name and, optionally, a default value that is used if no value is supplied on a particular call to the function. The lines that follow contain the text of the function (i.e. the snippet represented by the function name), until \end appears on a line by itself:

See Functions for more details.