Public feed #889304

Miscellany

public text v1 · immutable
Raw Edit
·published 2008-02-02 20:51 UTC
rendered paste body
with Ada.Text_IO;
use Ada.Text_IO;

procedure Myprogram is

    -- My first little Ada program.
    c : Character;      -- c is a char variable, 1 character long.
    x : Integer := 10;  -- x is a integer variable. Default value 10.

    package Int_IO is new Ada.Text_IO.Integer_IO(Integer)
begin

    Put_Line( "All this program does is output some text" );
    Put_Line( "and try out a simple loop. Press enter to continue." );
    Get_Immediate( c );
    New_Line;
    
    Put_Line( "Lets do a simple loop, counting down from 10 to 0:" );
    loop
        Int_IO.Put( x );
        New_Line;
        x := x - 1;
        exit when x < 0;
    end loop;
    New_Line;
    Put_Line( "There! That was easy." );
    Put_Line( "Press Enter to quit." );
    Get_Immediate( c );

end myprogram;