11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DEFFUN<br />

Syntax<br />

DEFFUN function.name [([MAT] arg.1[,[MAT]arg.2]...)]<br />

[CALLING catalog.name]<br />

Description<br />

The <strong>UniBasic</strong> DEFFUN command declares a user-written function, making the<br />

function available in a <strong>UniBasic</strong> program. You must declare the function before you<br />

can use it in a program.<br />

Note: You also must define the function with the <strong>UniBasic</strong> FUNCTION command in<br />

a separately cataloged file before you can call it.<br />

Function Naming<br />

The function name used in the DEFFUN statement must be the same as the name of<br />

the cataloged file that contains the FUNCTION statement. Either of the following<br />

statements declares the function cataloged under the name func.name:<br />

1-197 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />

DEFFUN func.name(arg, arg,...)<br />

DEFFUN name(arg, arg,...) CALLING func.name<br />

Within the calling program, the name used in the DEFFUN statement and the name<br />

used to call the function must be the same. This does not need to be the same name<br />

as the cataloged program file or the name used in the FUNCTION statement.

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

Saved successfully!

Ooh no, something went wrong!