Anvil | Smiths Smiths | Register Register | Login Login |
Search:
Show links Show tools Show tree | Previous document Next document | njet.org > Anvil > Documentation > Language reference > Templates > Tags > <function>

<function>

  <function 
    name="symbolname" 
    ( ( param="symbolparam-name" [ default="exprconst" ] )* [ rest="symbolcollector" ]
    | params="arguments" )
    [ preserve | compress | pack | silent ] >

    ( <import> |
      statement ) *
  </function>  

A ``function´´ tag defines a function (or method) to enclosing scope. It may contain statement and imports tags.

Attributes:

name
Name of function.
param
Name of parameter.
default
Default value of previously given parameter; must follow param attribute. Value is given as an expression that must evaluate to a constant at compile time.
rest
Optional name for a collector variable, gathering all extra arguments from a function call.
params
Parameter list given with the same syntax as function declarations. This attribute is mutually exclusive with param, default, and rest pairs.
preserve
Content control: retain content as is.
compress
Content control: compress whitespace. This is the default option.
pack
Content control: radically compress white spaces.
silent
Content control: do not print text and tags

Content control attributes are mutually exclusive. Behaviour defined in module will inherit to functions. Behaviour can also be modified with content control tags.

Contributes notes:
Add a note
What's new | Anvil