6.0

Table Of Contents
97
function @name( arglist )
...
endfunction()
Arguments
name — Name to use for the function, prefixed with the @ character. The name must conform to the rules
for names described in “Names” on page 7. It is good practice to be careful naming functions that you
define in different documents, to ensure that if at some point you want to copy code between documents,
the names of functions do not conflict.
arglist — List of arguments the function requires, where each element in the list has the syntax varname :
type. For example, &date : string. An ampersand always precedes the first letter of varname. A comma
separates each element in the list. Note that all arguments are pass by value (as opposed to pass by
reference). Pass by value means that the function you define cannot modify any of the arguments it
receives. Any modifications you make to an argument within the body of the function are made to a local
copy, and do not affect the original.
type — Type of value (integer, measure, currency, string, Boolean) the function returns.
Code Sample Example
function @showtext(&mystring: string)
moveto(1,1)
show(&mystring)
endfunction()
Code Sample Example
This example illustrates a procedure that creates a 3D pie chart.
Example
function @_3DPie( &W:measure, &H:measure, &HB:measure, &S:measure, &E:measure,
&L:string, &c:color )
%====================================================
% &W is the total width of the pie chart
% &H is the total height of the pie chart
% &HB is the height of the lower band
% &S is the starting angle (0..360)
% &E is the ending angle (0..360 and bigger than &S)
% &L is the label text