unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    procedure Button3Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button3Click(Sender: TObject);
begin
close;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
     if edit1.Text :='笑书神侠倚碧鸳' then
     showmessage('Right!Congratulations!');
     else
     showmessage('Sorry!Input again?');end;procedure TForm1.Button2Click(Sender: TObject);
begin
     edit1.Text :='';
end;end.
它说     if edit1.Text :='笑书神侠倚碧鸳' then   这一句出错了
错误提示:[Error] Unit1.pas(41): Type of expression must be BOOLEAN

解决方案 »

  1.   

    if (edit1.Text ='笑书神侠倚碧鸳') then   
    :=是赋值语句
    =是逻辑判断语句
    =:赋值参数语句
    一定要搞清楚了!
      

  2.   

    if edit1.Text :='笑书神侠倚碧鸳' if 后这一句实际上是一个布尔形的表达式,布尔表达式要用=,而不是赋值链接符
      

  3.   

    edit1.Text :='笑书神侠倚碧鸳' --->edit1.Text ='笑书神侠倚碧鸳'
      

  4.   

    if edit1.Text='笑书神侠倚碧鸳' then
         showmessage('Right!Congratulations!');
         else
         showmessage('Sorry!Input again?');