comp.lang.ada
 help / color / mirror / Atom feed
* use Ada.Text_IO in main() or Package?
@ 2017-09-14  5:09 Mace Ayres
  2017-09-14  5:12 ` Mace Ayres
  2017-09-14  6:21 ` gautier_niouzes
  0 siblings, 2 replies; 10+ messages in thread
From: Mace Ayres @ 2017-09-14  5:09 UTC (permalink / raw)


I am moving code I had in main() into a package and getting errors.
In main(), I had with Ada.Text_IO and use Ada.Text_IO and all worked OK.
When moving code into a package, to be called from Main(),
     with and use clauses in Main() are not seen in Package code & adding with and use Ada-Text_IO in package throws error "with can only appear in context clause"
I get lost here.

- --------------------------
package body structures is  
   
 with Ada.Text_IO;
 use  Ada.Text_IO;

   
 PROCEDURE set_up is         --------------------------------
      
with  Ada.Text_IO; use Ada.Text_IO;   -- throws error, without it errors in put_line and other Ada.Text_IO functions..
type grid is array (1..9) of Integer;
layer_1: grid:=(1,2,3,4,5,6,7,8,9);
   
begin
New_Line(2);
   Put_Line("Hello Michael from Ada");
   Put_Line(sayhi("Hi"));  -- parameter not used in structures::say; it uses its own
   New_Line;
   for i of layer_1 loop
      Put ("Layer 1 grid one dimension has values:" );
      Put(layer_1(i),Width=>2);       -- Width :=3));
          New_Line;
   end loop;
   New_line(2);      
end set_up;  ----------------------------------------------- 
   
    


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-09-15  5:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-14  5:09 use Ada.Text_IO in main() or Package? Mace Ayres
2017-09-14  5:12 ` Mace Ayres
2017-09-14  6:33   ` Petter Fryklund
2017-09-14  6:51     ` Mace Ayres
2017-09-15  5:22       ` Petter Fryklund
2017-09-14  6:21 ` gautier_niouzes
2017-09-14  6:47   ` Mace Ayres
2017-09-14  7:13     ` gautier_niouzes
2017-09-14  9:37       ` Mace Ayres
2017-09-14  9:49         ` gautier_niouzes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox