Riccardo

Authored Comments

Hmmm... It flattens out the indentation. Oh well...

I guess this is a rare item for your collection: the Ada version

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Numerics.Discrete_Random;

procedure Main is
type Game_Value is range 1 .. 100;

package Game_Io is
new Ada.Text_IO.Integer_IO (Game_Value);

package Game_Random is
new Ada.Numerics.Discrete_Random (Game_Value);

Random_Generator : Game_Random.Generator;

Guess_Me : constant Game_Value := Game_Random.Random (Random_Generator);
User_Guess : Game_Value;
begin
loop
Game_Io.Get (User_Guess);

if User_Guess > Guess_Me then
Put_Line ("Too large");

elsif User_Guess < Guess_Me then
Put_Line ("Too small");

else
Put_Line ("Correct!");
exit;
end if;
end loop;
end Main;