6.3 Subprogram Bodies
Syntax
Legality Rules
Static Semantics
A 
subprogram_body 
is considered a declaration. It can either complete a previous declaration, 
or itself be the initial declaration of the subprogram. 
 
Dynamic Semantics
The elaboration of a nongeneric 
subprogram_body 
has no other effect than to establish that the subprogram can from then 
on be called without failing the Elaboration_Check. 
 
Examples
Example of procedure 
body: 
procedure Push(E : in Element_Type; S : in out Stack) is
begin
   if S.Index = S.Size then
      raise Stack_Overflow;
   else
      S.Index := S.Index + 1;
      S.Space(S.Index) := E;
   end if;
end Push;
Example of a 
function body: 
function Dot_Product(Left, Right : Vector) return Real is
   Sum : Real := 0.0;
begin
   Check(Left'First = Right'First and Left'Last = Right'Last);
   for J in Left'Range loop
      Sum := Sum + Left(J)*Right(J);
   end loop;
   return Sum;
end Dot_Product;
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe