標題案例使用列舉 IO 為子範圍

字元大小寫的變化Enumeration_IO相結合併為影象使用文字緩衝區。第一個角色被操作到位。

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Handling; use Ada.Characters.Handling;

procedure Main is
    type Fruit is (Banana, Pear, Orange, Melon);
    package Fruit_IO is new Enumeration_IO (Fruit);
    Buffer : String (1 .. Fruit'Width);
begin
   for I in Fruit range Pear .. Fruit'Last loop
       Fruit_IO.Put (To => Buffer,
                     Item => I,
                     Set => Lower_Case);
       Buffer (Buffer'First) := To_Upper (Buffer (Buffer'First));
       Put_Line (Buffer);
   end loop;
end;

結果

Pear  
Orange
Melon