Skip to content

Instantly share code, notes, and snippets.

@yudai
Last active December 14, 2015 15:29
Show Gist options
  • Save yudai/5108301 to your computer and use it in GitHub Desktop.
Save yudai/5108301 to your computer and use it in GitHub Desktop.
with Ada.Text_IO; use Ada.Text_IO;
procedure Array_Test is
From_Array : array (1 .. 3) of Integer;
To_Array : array (1 .. 3) of Integer;
begin
From_Array := (1, 2, 3);
To_Array := From_Array;
From_Array := (others => 0);
for I in From_Array'Range loop
Put(Integer'Image(From_Array(I)));
end loop;
for I in To_Array'Range loop
Put(Integer'Image(To_Array(I)));
end loop;
end Array_Test;
with Ada.Text_IO; use Ada.Text_IO;
procedure Array_Test is
type Sample_Array_Type is array (1 .. 3) of Integer;
From_Array : Sample_Array_Type;
To_Array : Sample_Array_Type;
begin
From_Array := (1, 2, 3);
To_Array := From_Array;
From_Array := (others => 0);
for I in Sample_Array_Type'Range loop
Put_Line(Integer'Image(From_Array(I)));
end loop;
for I in Sample_Array_Type'Range loop
Put_Line(Integer'Image(To_Array(I)));
end loop;
end Array_Test;
@yudai
Copy link
Author

yudai commented Mar 7, 2013

Result:
0
0
0
1
2
3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment