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