8.3 Text console interaction - JulTob/Ada GitHub Wiki
WITH Text_Io; -- text IO package
PROCEDURE Welcome IS
BEGIN
Text_IO.Put_Line( "Welcome to Ada");
Text_IO.New_Line;
Text_IO.Put_Line( "Thanks for playing!");
END;
with text_io; use text_io;
procedure Short_story is
yourName : string(1..50); -- declares a string array
Length : integer;
Begin
Put("Identify yourself! (Write your name): " );
get_line(yourName, length);
new_line;
Put(YourName(1..length));
Put_Line(" , your unit landed on the planet and was attacked by 50 aliens.");
Put(YourName(1..length));
Put_Line(" fought bravely and killed 12 attackers, after which the");
Put("remaining aliens fled. ");
Put(YourName(1..length));
Put_Line(" was able to crawl back to his ship");
put_line("where his medical officer successfully treated his wounds.");
END Short_story;
S : String;
n : Number;
c : character;
len : Integer;
...
put(s); -- Display String
put(n'img); -- Display Number
New_Line; -- Start a new Line
Put_Line(s); -- Put and then new line
get(c); -- Read a character from the keyboard
get_Line(s, len); -- Read a line of text from keyboard and set it's length
put( s & c ) -- Concatenate character into string
put( s & " " & s) -- Concatenate strings into a new strings