Ada Programming/Keywords/reverse

< Ada Programming‎ | Keywords

Ada Lovelace 1838.jpg

This keyword is used in for loops to specify that the loop is performed in reverse order:

  for I in reverse 1 .. 10 loop
     Ada.Integer_Text_IO.Put (I);
     Ada.Text_IO.New_Line;
  end loop;

Outputs:

        10
         9
         8
         7
         6
         5
         4
         3
         2
         1

See alsoEdit