Functions

[% sub bold(text); "<b>$text</b>"; end; bold('Hello World') %]--EOF--
look inside...
Thus Spake Andy:

You can also define functions using the explicit sub command. Here it is in traditional TT2 style using semi-colons and end to delimit the block. Note that we support function parameters natively (like Javascript, Python, Ruby, Perl 6, etc).