25.01.2015 Views

Using Caché ObjectScript - InterSystems Documentation

Using Caché ObjectScript - InterSystems Documentation

Using Caché ObjectScript - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

7<br />

Functions<br />

Functions are pieces of code which perform common tasks. Functions may either return a value or execute silently without<br />

returning a value. <strong>Caché</strong> supplies dozens of functions, which can perform mathematical operations, manipulation of strings<br />

and time values, and perform other actions.<br />

System-supplied functions (sometimes known as “intrinsic” functions), which you cannot modify, are identifiable as they<br />

always begin with a single dollar sign (“$”); the <strong>Caché</strong> <strong>ObjectScript</strong> Language Reference describes each of the systemsupplied<br />

functions. In addition to its system-supplied functions, <strong>ObjectScript</strong> also supports user-defined code (sometimes<br />

known as “extrinsic” code).<br />

7.1 Function Syntax<br />

To invoke a system-supplied function, use the form:<br />

$name(parameters)<br />

where<br />

Table 7–1: Invoking <strong>Caché</strong> <strong>ObjectScript</strong> Functions<br />

name<br />

parameters<br />

The name of the function. The preceding dollar sign ($) is required. Function names<br />

are not case-sensitive, whether system-supplied or user-defined (method names<br />

are not). Many system function names have abbreviations; each of these is listed in<br />

the reference page for the function itself.<br />

One or more values to be passed to the function. The parentheses are mandatory,<br />

even if the function has no parameters. The parameters are positional and must<br />

match the order of the parameters expected by the function. Multiple parameters<br />

are separated from each other by commas. Spaces are permitted anywhere in the<br />

parameter list. No spaces are permitted between name and the open parenthesis<br />

character.<br />

Function parameters represent specific values that you supply. All defined parameters are shown in each syntax section.<br />

Some of these parameters are required and some are optional. Optional arguments and parameters are indicated as such in<br />

the Parameters section of each reference page.<br />

Also shown in many syntax sections are required punctuation characters used with some parameters. These include parentheses,<br />

commas, curly braces, colons, equal signs, and plus and minus signs.<br />

<strong>Using</strong> <strong>Caché</strong> <strong>ObjectScript</strong> 73

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!