[Delphi] 3항 연산자, IfThen
Posted on 2016. 4. 28. 14:33
Filed Under Programming/Delphi
If문으로 여러줄 작성해야할 코드를 1줄로 작성할 수 있는 매력적인 연산자~!
기본형태: IfThen(비교문, True리턴값, False리컨값)
총 4가지 오버로드 형태가 있음.
기본형태: IfThen(비교문, True리턴값, False리컨값)
총 4가지 오버로드 형태가 있음.
// 1-3) Math
function IfThen(AValue: Boolean; const ATrue: Integer;
const AFalse: Integer = $0): Integer; overload;
function IfThen(AValue: Boolean; const ATrue: Int64;
const AFalse: Int64 = $0): Int64; overload;
function IfThen(AValue: Boolean; const ATrue: Double;
const AFalse: Double = 0): Double; overload;
// 4) StrUtils
function IfThen(AValue: Boolean; const ATrue: string;
AFalse: string = ''): string; overload;
}
반응형