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.

Parameters<br />

The following table describes each parameter of the syntax.<br />

Parameter Description<br />

function.name Specifies the function name that the calling statement uses in<br />

this program.<br />

(MAT arg.1 ,MAT<br />

arg.2...)<br />

Examples<br />

Specifies the arguments to be passed to the function. You must<br />

enclose arguments in parentheses and separate them with<br />

commas. Precede an argument with MAT to indicate that the<br />

argument is an array.<br />

CALLING file.name Specifies the function’s cataloged file name. Include this<br />

statement if the cataloged program name differs from<br />

function.name. Can be a literal or variable.<br />

DEFFUN Parameters<br />

The DEFFUN statement in the following example declares myfunc. The CALLING<br />

clause indicates that the name of the cataloged file that contains the FUNCTION<br />

statement is called yourfunc. In the first print statement, the function is called and the<br />

return value is printed.<br />

DEFFUN myfunc(a, MAT b, c) CALLING "yourfunc" ;* Declare function.<br />

DIM b(10) ;* Define array.<br />

a = 2 ;* Set upper bound.<br />

FOR i = 1 TO a ;* Initialize array.<br />

b(i) = i<br />

NEXT i<br />

PRINT "r from FUNCTION: ":myfunc(a, MAT b, c)<br />

PRINT "c from FUNCTION: ":c<br />

DEFFUN 1-198

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

Saved successfully!

Ooh no, something went wrong!