home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol8n19.zip / ENUMLAST.PAS < prev    next >
Pascal/Delphi Source File  |  1989-10-02  |  591b  |  34 lines

  1. ENUMLAST.PAS
  2.  
  3.  
  4.  
  5.  
  6. PROGRAM Enumerated;
  7. (* Insert more items in the enumerated type "Fruit". The
  8.    program will still correctly display the ordinal values
  9.    of all the items.*)
  10. TYPE
  11.   Fruit = (Apple, Orange, Grape, Pineapple);
  12.   FruitRay = array[Fruit] of byte;
  13.  
  14. CONST
  15.   FirstFruit = Fruit(0);
  16.   LastFruit = Fruit(sizeof(FruitRay)-1);
  17.  
  18. PROCEDURE ShowAllFruits;
  19. VAR
  20.   F : Fruit;
  21. BEGIN
  22.   WriteLn('Here are the ordinal values of all the fruits:');
  23.     For F := FirstFruit To LastFruit DO
  24.       Write( Ord(F):3 );
  25.   WriteLn;
  26. END;
  27.  
  28. BEGIN
  29.   ShowAllFruits;
  30. END.
  31.  
  32.  
  33.  
  34.