home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog2 / compare.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  784 b   |  42 lines

  1.                                        -- Chapter 4 - Program 1
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure Compare is
  6.  
  7.    package Enum_IO is new Text_IO.Enumeration_IO(BOOLEAN);
  8.    use Enum_IO;
  9.  
  10.    One   : INTEGER := 1;
  11.    Two   : INTEGER := 2;
  12.    Three : INTEGER := 3;
  13.  
  14.    Is_It : BOOLEAN := TRUE;      -- initialized
  15.    Which : BOOLEAN;              -- uninitialized
  16.  
  17. begin
  18.  
  19.    Which := TRUE;
  20.    Put("Which now has the value of ");
  21.    Put(Which);
  22.    New_Line;
  23.    Which := FALSE;
  24.    Put("Which now has the value of ");
  25.    Put(Which);
  26.    New_Line;
  27.  
  28.    Is_It := (One + 1) = Two;
  29.    Is_It := One /= Two;
  30.    Is_It := One + Two >= Three;
  31.  
  32. end Compare;
  33.  
  34.  
  35.  
  36.  
  37. -- Result of execution
  38.  
  39. -- Which now has the value of TRUE
  40. -- Which now has the value of FALSE
  41.  
  42.