Delphi中if c then 与if c=true then 的区别?procedure Tform1.button1click(sender:Tobject);var t:boolean;beginif t then edit1.text :='t=true'else if not t then edit1.text := 't=false'else edit1.text := '111';//结果返回TRUEend;procedure Tform1.b

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/01 05:06:11

Delphi中if c then 与if c=true then 的区别?procedure Tform1.button1click(sender:Tobject);var t:boolean;beginif t then edit1.text :='t=true'else if not t then edit1.text := 't=false'else edit1.text := '111';//结果返回TRUEend;procedure Tform1.b
Delphi中if c then 与if c=true then 的区别?
procedure Tform1.button1click(sender:Tobject);
var t:boolean;
begin
if t then edit1.text :='t=true'
else if not t then edit1.text := 't=false'
else edit1.text := '111';//结果返回TRUE
end;
procedure Tform1.button2click(sender:Tobject);
var t:boolean;
begin
if t=true then edit1.text :='true'
else if t=false then edit1.text := 'false'
else edit1.text := '111';//结果返回111
end;
为什么返回的结果不同?

Delphi中if c then 与if c=true then 的区别?procedure Tform1.button1click(sender:Tobject);var t:boolean;beginif t then edit1.text :='t=true'else if not t then edit1.text := 't=false'else edit1.text := '111';//结果返回TRUEend;procedure Tform1.b
在没对t 赋值时,系统默认为true
在button1的if中是判断t是否为真,而button2的if中是判断t是否等于true(是有对t已经赋值了),所以在button2中系统只执行else edit1.text := '111'

希望我的回答对你有帮助,愿早日解开你的疑惑!

Delphi中if c then 与if c=true then 的区别?procedure Tform1.button1click(sender:Tobject);var t:boolean;beginif t then edit1.text :='t=true'else if not t then edit1.text := 't=false'else edit1.text := '111';//结果返回TRUEend;procedure Tform1.b delphi中if then else语句怎么写.举个最简单的例子 求C语句中if与then之间的用法 delphi if a in[1,2,3,4,5] then b='c' else b=''如果a等于1,2,3,4,5时b等于c,否则等于空 这个句子在delphi报表里面怎么写? 与if Option1.value=true then这条语句不等价的是?A)if option1.value then B)if option1=true C) if value=true then D)if option1 then C语言中if-else-if与多个顺序if有什么区别? delphi for i := 1 to 10 do begin if Terminated then Exit; sleep(100); end;for i := 1 to 10 dobeginif Terminated thenExit;sleep(100);end; C语言中有if then语句么?我的C语言书上只有if-else.我怀疑是不是if then中的then可以省略?比如if(a==5){then y=5;}else y=6;这个then可以写也可以不写?我的书里没有if then if后加()是什么意思 比如:if (t=3) then xxxxxx end if 语句中 if 如果if t = 3 then xxxxxend if 它们有什么区别? C语言中if(! C语言中if(! C语言中if(! C语中if(! if-then-else是什么意思 If text1.text then... 在C语言中if(x=0)与if(x==0)的区别 if(0 A=2:b=1:c=0 if a then if b then if c then Print “1” else Print “2” else Print “3” else Print if.then if.then if.then else end if 以上这种语句是不对的吗? if.then不能循环?