📄 declare_program.adb
字号:
with Text_IO; use Text_IO;
with ada.integer_text_io; use ada.integer_text_io;
procedure declare_program_using_function is
a : Integer := 99;
b : Integer := 1;
j : Integer := -99;
package int_io is new Text_IO.Integer_IO (Integer);-- package instantiation
function add (x : in out Integer; y : in Integer) return x is -- procedure
-- x and y are the formal parameters
-- the information has to be returned to the calling environment by
-- writing to the formal parameters using the mode OUT.
--this will updates the actual parameters.
i : Integer := 10;
j : Integer := 10;
k: Integer:=55;
begin
x := x + y;
Text_IO.Put("Value of j is = ");
int_io.Put (j); new_line;
put(j);-- no error bcoz of ada.integer_text_io package
declare
k : Integer := 50;
begin
Text_IO.Put ("Value of k inside declare is = ");
int_io.Put (k);new_line;
Text_IO.Put ("accessing the Value of k outside declare is = ");
int_io.Put (add.k);
Text_IO.New_Line;
end;
int_io.Put (j);new_line;
int_io.Put (declare_program.j);new_line;
end add;
begin
add (a, b);-- a and b are the actual parameters
Text_IO.Put ("Value of a is = ");
int_io.Put (a);
-- Text_IO.Put_Line ("Value of i is = ");
-- int_io.Put (i);
end declare_program;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -