ocean9
asked on
Immediate IIF()
Hi all,
I am trying to write an IIF function (like one in C ?: and Access) in Delphi 3.0. Any help would be appreciated.
construct: IIF( <logical expr.>, <TruePart>, <FalsePart>)
example: x := IIF( x > y, 100, 50)
equivalent to
If x > y then
x := 100
else
x := 50;
I am trying to write an IIF function (like one in C ?: and Access) in Delphi 3.0. Any help would be appreciated.
construct: IIF( <logical expr.>, <TruePart>, <FalsePart>)
example: x := IIF( x > y, 100, 50)
equivalent to
If x > y then
x := 100
else
x := 50;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
eps, your're too quick!
the Variant was a nice touch.
Another way is overloading but you need to implement a function for each type this way.....
CalvinDay, sorry :o)
CalvinDay, sorry :o)
>the Variant was a nice touch.
Yeap! I thought that too.
Alex
Yeap! I thought that too.
Alex
ASKER
Thanks Epsylon and you too CalvinDay.
begin
if test then
Result:=iftrue
else
Result:=iffalse;
end;