Anonymous user
Function prototype: Difference between revisions
m
→{{header|Diego}}: minor adjustments
m (→{{header|Diego}}: added Diego entry) |
m (→{{header|Diego}}: minor adjustments) |
||
Line 598:
with_funct(foo); // function as a 'method' with no arguments, no return type
// or ▼
begin_instruct(foo); // instructions are 'methods', no arguments, no return type▼
end_instruct[foo]; // explicit end of itself▼
with_instruct(foo); // instructions are 'methods', no arguments, no return type▼
// A prototype declaration for a function that requires two arguments
Line 630 ⟶ 620:
// A prototype declaration for a function that utilizes optional arguments
begin_funct({int}, ooo)_arg(o)_value(1); // optional argument with default value and return type
with_funct(ooo)_return([o]); // Can be shortened to [ooo]_ret([0]);
end_funct[];
begin_funct({int}, oxo)_arg(o,u,v)_opt(u)_value(1); // optional argument of second argument with default value and return type
[ooo]_ret(1); // the execution has to name arguments or missing in comma-separated list of arguments
end_funct[];
Line 654 ⟶ 644:
// Example of prototype declarations for subroutines or procedures (if these differ from functions)
▲begin_instruct(foo); // instructions are 'methods', no arguments, no return type
▲end_instruct[foo]; // explicit end of itself
▲with_instruct(foo); // instructions are 'methods', no arguments, no return type
begin_funct(yoo)_arg(robotMoniker)_param(b); // A '_funct' can be used as a subroutine when missing the '{}' return datatype
|