Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
1
Task/Call-a-function/Ada/call-a-function-1.ada
Normal file
1
Task/Call-a-function/Ada/call-a-function-1.ada
Normal file
|
|
@ -0,0 +1 @@
|
|||
S: String := Ada.Text_IO.Get_Line;
|
||||
5
Task/Call-a-function/Ada/call-a-function-2.ada
Normal file
5
Task/Call-a-function/Ada/call-a-function-2.ada
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
function F(X: Integer; Y: Integer := 0) return Integer; -- Y is optional
|
||||
...
|
||||
A : Integer := F(12);
|
||||
B : Integer := F(12, 0); -- the same as A
|
||||
C : Integer := F(12, 1); -- something different
|
||||
12
Task/Call-a-function/Ada/call-a-function-3.ada
Normal file
12
Task/Call-a-function/Ada/call-a-function-3.ada
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
type Integer_Array is array (Positive range <>) of Integer;
|
||||
function Sum(A: Integer_Array) return Integer is
|
||||
S: Integer := 0;
|
||||
begin
|
||||
for I in A'Range loop
|
||||
S := S + A(I);
|
||||
end loop;
|
||||
return S;
|
||||
end Sum;
|
||||
...
|
||||
A := Sum((1,2,3)); -- A = 6
|
||||
B := Sum((1,2,3,4)); -- B = 10
|
||||
9
Task/Call-a-function/Ada/call-a-function-4.ada
Normal file
9
Task/Call-a-function/Ada/call-a-function-4.ada
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
function H (Int: Integer;
|
||||
Fun: not null access function (X: Integer; Y: Integer)
|
||||
return Integer);
|
||||
return Integer;
|
||||
|
||||
...
|
||||
|
||||
X := H(A, F'Access) -- assuming X and A are Integers, and F is a function
|
||||
-- taking two Integers and returning an Integer.
|
||||
3
Task/Call-a-function/Ada/call-a-function-5.ada
Normal file
3
Task/Call-a-function/Ada/call-a-function-5.ada
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Positional := H(A, F'Access);
|
||||
Named := H(Int => A, Fun => F'Access);
|
||||
Mixed := H(A, Fun=>F'Access);
|
||||
Loading…
Add table
Add a link
Reference in a new issue