Function prototype: Difference between revisions

Content added Content deleted
(→‎{{header|SNOBOL4}}: Expanded on SNOBOL4 example.)
m (Oops. Screwed up the wiki formatting.)
Line 890: Line 890:
The <code>define()</code> BIF is used for more than merely providing function-like access to a label with the same name. It is used to prototype all of these (with some default behaviour):
The <code>define()</code> BIF is used for more than merely providing function-like access to a label with the same name. It is used to prototype all of these (with some default behaviour):


* the function name (<code>multiply</code> in the examples);
* the function name (<code>multiply</code> in the examples);
* the formal arguments to the function (<code>a, b</code> in the examples);
* the formal arguments to the function (<code>a, b</code> in the examples);
* the entry point label for the function's code (defaults to the function name);
* the entry point label for the function's code (defaults to the function name);
* any local variables which should be protected in the function (defaults to none).
* any local variables which should be protected in the function (defaults to none).


Thus a highly-contrived example function that illustrates all of these would look like this:
Thus a highly-contrived example function that illustrates all of these would look like this: