Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
24
Task/Nested-function/Ada/nested-function.ada
Normal file
24
Task/Nested-function/Ada/nested-function.ada
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
with Ada.Text_IO;
|
||||
|
||||
procedure Nested_Functions is -- 'Nested_Functions' is the name of 'main'
|
||||
|
||||
type List is array(Natural range <>) of String(1 .. 10);
|
||||
|
||||
function Make_List(Separator: String) return List is
|
||||
Counter: Natural := 0;
|
||||
|
||||
function Make_Item(Item_Name: String) return String is
|
||||
begin
|
||||
Counter := Counter + 1; -- local in Make_List, global in Make_Item
|
||||
return(Natural'Image(Counter) & Separator & Item_Name);
|
||||
end Make_Item;
|
||||
|
||||
begin
|
||||
return (Make_Item("First "), Make_Item("Second"), Make_Item("Third "));
|
||||
end Make_List;
|
||||
|
||||
begin -- iterate through the result of Make_List
|
||||
for Item of Make_List(". ") loop
|
||||
Ada.Text_IO.Put_Line(Item);
|
||||
end loop;
|
||||
end Nested_Functions;
|
||||
Loading…
Add table
Add a link
Reference in a new issue