Anonymous user
Call a function: Difference between revisions
m
→{{header|Ada}}
m (→{{header|Ada}}) |
m (→{{header|Ada}}) |
||
Line 25:
* Ada provides for functions with optional parameters:<lang Ada>function F(X: Integer; Y: Integer := 0) return Integer;
...
A : Integer := F(12);
B : Integer := F(12, 0); -- the same as A
C : Integer := F(12, 1); -- something different</lang>
* The caller is free to use either a positional parameters or named parameters, or a mixture of both (with positional parameters first) <lang Ada>
* Ada does not allow a variable number of arguments. But a function argument can be an unconstrained array with as many arguments as you want:<lang Ada>type Integer_Array is array (Positive range <>) of Integer;
Line 51 ⟶ 53:
X := H(A, F'Access) -- assuming X and A are Integers, and F is a function
-- taking two Integers and returning an Integer.</lang>
=={{header|Icon}} and {{header|Unicon}}==
|