summaryrefslogtreecommitdiff
path: root/guess/src/guess.adb
blob: dc394fa8c4401c4615771d8609377eebb4abe74a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
with Ada.Text_IO;         use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;

procedure Guess is
  Answer : Integer := 47;
  Guess  : Integer;
begin
  loop
    Put ("Enter a number: ");
    Get (Guess);
    if Guess < Answer then
      Put_Line ("Too low!");
    elsif Guess > Answer then
      Put_Line ("Too high!");
    elsif Guess = Answer then
      Put_Line ("Correct!");
    end if;
    exit when Guess = Answer;
  end loop;
end Guess;