Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
28
Task/Call-a-function/ALGOL-68/call-a-function.alg
Normal file
28
Task/Call-a-function/ALGOL-68/call-a-function.alg
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# A function without arguments: #
|
||||
f();
|
||||
# or #
|
||||
f;
|
||||
|
||||
# A function with a fixed number of arguments: #
|
||||
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.
|
||||
For full ALGOL compatibility, though, they should be in the form "VOID (f ());" #
|
||||
|
||||
# A function's return value being used: #
|
||||
x := f(y);
|
||||
|
||||
# There is no distinction between built-in functions and user-defined functions. #
|
||||
|
||||
# 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. #
|
||||
Loading…
Add table
Add a link
Reference in a new issue