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
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
:=是赋值语句
=是逻辑判断语句
=:赋值参数语句
一定要搞清楚了!
showmessage('Right!Congratulations!');
else
showmessage('Sorry!Input again?');