Ada Programming/Attributes/'Max


Ada Lovelace 1838.jpg

DescriptionEdit

'Max(X, Y) is a scalar type attribute. It returns the greater of the two parameters.

ExampleEdit

  type My_Enum is (Enum1, Enum2, Enum3);
  A : Integer :=  3;
  B : Integer := -5;
  X : Float :=  1.0;
  Y : Float :=  1.5;
  ...
  pragma Assert (My_Enum'Max(Enum3, Enum1) = Enum3); 
  pragma Assert (Integer'Max(A, B) = 3);
  pragma Assert (Float'Max(X, Y) = 1.5);

See alsoEdit

WikibookEdit

Ada Reference ManualEdit

Last modified on 28 November 2012, at 11:58