D
delhpi
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm3 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
function Test:boolean;
begin
//假设有这个空的返回值是boolean型 函数
end;
procedure TForm3.Button1Click(Sender: TObject);
begin
if test then //写法差异在这句
caption:='true'
else
caption:='false';
end;
procedure TForm3.Button2Click(Sender: TObject);
begin
if test =true then //写法差异在这句
caption:='true'
else
caption:='false';
end;
end.
if test then
和
if test=true then
有什么区别吗?
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm3 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
function Test:boolean;
begin
//假设有这个空的返回值是boolean型 函数
end;
procedure TForm3.Button1Click(Sender: TObject);
begin
if test then //写法差异在这句
caption:='true'
else
caption:='false';
end;
procedure TForm3.Button2Click(Sender: TObject);
begin
if test =true then //写法差异在这句
caption:='true'
else
caption:='false';
end;
end.
if test then
和
if test=true then
有什么区别吗?