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

  1.                                        -- Chapter 11 - Program 4
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure StrngCmp is
  6.  
  7.    MY_CAR   : constant STRING := "Ford";
  8.    YOUR_CAR : constant STRING := "FORD";
  9.    Her_Car  : STRING(1..8) := "Mercedes";
  10.    Rental   : STRING(1..4);
  11.    Lease    : STRING(1..4);
  12.  
  13. begin
  14.  
  15.    if MY_CAR /= YOUR_CAR then
  16.       Put_Line("Case matters in a STRING constant or variable");
  17.    end if;
  18.  
  19.    Her_Car := "Ford    ";    -- This is still not equal to My_Car
  20.    Rental := MY_CAR;
  21.    Rental := "Junk";
  22.    Lease := Rental;
  23.  
  24.    If Rental = "Junk" then
  25.       Put_Line("A variable can be compared to a string literal.");
  26.    end if;
  27.  
  28. end StrngCmp;
  29.  
  30.  
  31.  
  32.  
  33. -- Result of execution
  34.  
  35. -- Case matters in a STRING constant or variable
  36. -- A variable can be compared to a string literal.
  37.  
  38.