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

  1.                                        -- Chapter 6 - Program 3
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure BoolVars is
  6.  
  7.    package Bool_IO is new Text_IO.Enumeration_IO(BOOLEAN);
  8.    use Bool_IO;
  9.  
  10.    Correct  : BOOLEAN;
  11.    Maybe    : BOOLEAN;
  12.    Probably : BOOLEAN;
  13.  
  14. begin
  15.  
  16.    Correct := TRUE;                        -- TRUE
  17.    Maybe := FALSE;                         -- FALSE
  18.    Probably := Correct or Maybe;           -- TRUE
  19.    Probably := Correct and Maybe;          -- FALSE
  20.    Probably := Correct xor Maybe;          -- TRUE
  21.    Probably := Correct and not Maybe;      -- TRUE
  22.    Probably := BOOLEAN'FIRST;              -- FALSE
  23.    Probably := BOOLEAN'LAST;               -- TRUE
  24.    if Maybe < Correct then
  25.       Put("FALSE is of less value than TRUE in a BOOLEAN variable");
  26.       New_Line;
  27.    end if;
  28.  
  29.    Put(Correct,8);
  30.    Put(Maybe,8);
  31.    New_Line;
  32.  
  33. end BoolVars;
  34.  
  35.  
  36.  
  37.  
  38. -- Result of execution
  39.  
  40. -- FALSE is of less value than TRUE in a BOOLEAN variable
  41. -- TRUE    FALSE
  42.  
  43.