
134 Appendix A6 OxGauss Language Reference
without explicit value and without dimensions, it will default to an int with value 0. The
type of assignment symbol only matters when the variable already has a value: = and
!= reassign, := results in an error, and ?= leaves the old value.
The variable is within the scope of the remainder of the source file. The external
statement makes the variable available elsewhere.
A6.6.3 Function (procedure, fn, keyword) definitions
function-statement:
proc return-count
opt
identifier (variable-list
opt
); proc-statement-list endp;
fn identifier (variable-list
opt
)= expression ;
keyword identifier (argument-identifier); proc-statement-list endp;
return-count:
( int-constant-expression )
int-constant-expression
proc-statement-list:
proc-statement
proc-statement-list proc-statement
proc-statement:
statement
local-statement
retp-statement
local-statement:
local typed-list;
typed-list:
typed-identifier
typed-list, typed-identifier
typed-identifier:
identifier
identifier:function-type
retp-statement:
retp;
retp(expression-list);
A function definition specifies the function header and body, and declares the func-
tion so that it can be used in the remainder of the file. A function can be declared many
times, but defined only once. An empty argument list indicates that the function takes
no arguments at all. Such a function can be called by the name only (or, which is better
coding practice, with () after the name).
proc(2) = test2(a1, a2); /* definition of test2 */
{
local b1;
b1 = test1(a2); /* call external function test1 */
Komentarze do niniejszej Instrukcji