问个Delphi中逻辑变量的问题(0分)

N

netbug

Unregistered / Unconfirmed
GUEST, unregistred user!
请看:
procedure TForm1.Button1Click(Sender: TObject);
var a:boolean;
begin
a:=true;
If a=true then
showMessage('hello');
end;
我记得过去在编程时,遇到逻辑变量不能进行判断,
象If a=true then
showMessage('hello');
end;
应该写成:
If a then
showMessage('hello');
end;
请问:在Delphi中,允许对逻辑变量进行判断吗?谢谢。


 
两种都可以……
 
当然可以,原来也行,a = true 也是逻辑值呀。
 
If a=true then <==> if a then
If a=false then <==> if not a then
 
同意上述所有看法
 
可以,我就用过if a=true,我觉得这样用程序易读。
 
从编译的角度上来说,有这个必要吗?
 
接受答案了.
 

Similar threads

S
回复
0
查看
949
SUNSTONE的Delphi笔记
S
S
回复
0
查看
770
SUNSTONE的Delphi笔记
S
S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
926
SUNSTONE的Delphi笔记
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
顶部