Anonymous user
Call a function: Difference between revisions
m
→{{header|Ada}}: Linguistic fixes
(→{{header|PARI/GP}}: +1) |
m (→{{header|Ada}}: Linguistic fixes) |
||
Line 24:
=={{header|Ada}}==
* Ada provides two kinds of subroutines: procedures
* As a rule of thumb, an Ada compiler is free to pass arguments either by value or by reference. Parameters have a mode
* There are no differences
* Functions without parameters can be called by omitting the parameter list (no empty brackets!):<lang Ada>S: String := Ada.Text_IO.Get_Line;</lang>
Line 38:
C : Integer := F(12, 1); -- something different</lang>
* If the number of parameters of F
* Ada does not support functions with a variable number of arguments. But a function argument can be an unconstrained array with as many values as you want:<lang Ada>type Integer_Array is array (Positive range <>) of Integer;
Line 63:
-- taking two Integers and returning an Integer.</lang>
* The caller is free to use either
Named := H(Int => A, Fun => F'Access);
Mixed := H(A, Fun=>F'Access); </lang>
|