declare_program_using_function.adb

来自「This contains the following topics and m」· ADB 代码 · 共 37 行

ADB
37
字号
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;   ret :integer;  package int_io is new Text_IO.Integer_IO (Integer);-- package instantiation   function add (x: in Integer ; y: in Integer ) return integer is  -- procedure      i : Integer := 10;      j : Integer := 10;      k: Integer:=55;   begin      Text_IO.Put("Value of j is = ");      int_io.Put (j);      new_line;      put(j);-- no error bcoz of ada.integer_text_io package      new_line;      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_using_function.j);new_line;      return(x+y);   end add;begin    ret := add (a, b);      int_io.Put (ret);     --  int_io.Put (i);end;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?