|
7.10 Hauptprogramm
Es gilt in Ada kein eigenes Sprachelement für das Hauptprogramm. Jede
parameterlose prozedur, die eine Bibliothekseinheit
ist, kann zum Hauptprogramm gemacht werden.
-- Kontextklauseln
with Ada.Text_IO;
with Bsp_UP;
-- parameterlose Prozedur als Hauptprogramm
procedure Zehnwurf is -- Deklarationsteil
Würfel : Bsp_UP.Würfel_Typ;
begin -- Zehnwurf
for I in 1..10 loop
Würfel := Bsp_UP.Zufallszahl;
Ada.Text_IO.Put_Line (Integer'Image
(I) & ". Wurf : " & Bsp_UP.Würfel_Typ'Image
(Würfel));
end loop;
end; |
Das Hauptprogramm wird erst ausgeführt, wenn alle in den Kontextklauseln
aufgeführten Übersetzungseinheit
elaboriet wurden (Elaborationsreihenfolge).
|