Delphi IfThen语句

 function IfThen(AValue: Boolean; const ATrue: string; AFalse: string = ''): string; overload; $[StrUtils.pas
 功能 返回指定的逻辑字符串


说明 

IfThen(True, '是', '否') = '是';

IfThen(False, '是', '否') = '否'


 例子 Edit3.Text := IfThen(CheckBox1.Checked, Edit1.Text, Edit2.Text);

类似C或C++中的 

变量=表达式是否为真 ? 如果为真的值:如果不为真的值

举例:

int a = (2>3) ? 1:0;

猜你喜欢

转载自www.cnblogs.com/mobilecard/p/9394259.html
今日推荐