{code}...{/code} takes its content as PAD source and renders it in a separate engine pass - a fresh build, as if the content were a little page of its own - and outputs what that pass produced. Inside, everything a page can do works: tags, fields, expressions, {set}.

Its main use is as a pipe. A value is text in PAD: a field holding {echo 1 + 1} prints those characters, it does not run them. Piping the value into code - {echo $snippet | code} - is the explicit way to say that it is a template, for a snippet kept in a database or a file.

By default the pass shares the page's state: it sees the variables and the stores, and what it sets stays behind. Four options change how isolated it is:

The same four options are read by {page}, which runs a whole page in such a pass. To show braces without running them, the opposite tool is {ignore}.