Anonymous user
Call a function: Difference between revisions
m
Added some information about pseudo-optional arguments in ALGOL 68.
m (Added some information about pseudo-optional arguments in ALGOL 68.) |
|||
Line 74:
f(1, x);
# ALGOL 68 does not support optional arguments, variable numbers of arguments, or named arguments.
However, some functions may take an argument "0" as an instruction to use the default value
(sort of a pseudo-optional argument). #
# In "Talk:Call a function" a statement context is explained as
"The function is used as an instruction (with a void context),
rather than used within an expression." Based on that, both ALGOL examples above are already in a statement context.▼
rather than used within an expression." Based on that,
▲
For full ALGOL compatibility, though, they should be in the form "VOID (f ());" #
Line 87 ⟶ 91:
# A subroutine is simply a function that returns VOID. #
# If the function is declared with argument(s) of mode REF MODE,
then those arguments are being passed by reference. #</lang>
See [http://rosettacode.org/wiki/First-class_functions#ALGOL_68 First-Class Functions] for an example of first-class functions in ALGOL 68.
|