The simplest directives are GET and SET which retrieve and update variable values respectively. The GET and SET keywords are actually optional as the parser is smart enough to see them for what they really are (but note the caveat below on using side-effect notation). Thus, you'll generally see:

[% SET foo = 10 %]
[% GET foo %]

written as:

[% foo = 10 %]
[% foo %]

You can also express simple logical statements as implicit GET directives:

All other directives should start with a keyword specified in UPPER CASE (but see the ANYCASE option). All directives keywords are in UPPER CASE to make them visually distinctive and to distinguish them from variables of the same name but different case. It is perfectly valid, for example, to define a variable called stop which is entirely separate from the STOP directive.

Directives such as FOREACH, WHILE, BLOCK, FILTER, etc., mark the start of a block which may contain text or other directives up to the matching END directive. Blocks may be nested indefinitely. The IF, UNLESS, ELSIF and ELSE directives also define blocks and may be grouped together in the usual manner.