[fpc-pascal] New feature: IfThen() intrinsic

Michael Van Canneyt michael at freepascal.org
Tue Feb 2 10:46:20 CET 2016



On Tue, 2 Feb 2016, Maciej Izak wrote:

> 2016-02-02 10:07 GMT+01:00 Michael Van Canneyt <michael at freepascal.org>:
>
>> Call me old fashioned, but then I think
>>   foo:=iif(Condition1,
>>            iif(Condition2, ThenExpr1, ElseExpr1),
>>            iif(Condition3, ThenExpr2, ElseExpr2));
>> is more clear.
>>
>> The "if then" construct is really confusing.
>> "if then" is a statement, not an expression.
>
>
> Yup, you are old fashioned :).
>
> maybe is good idea to discuss "it then else" expression in dedicated thread
> "if-then-else expression".
>
> conclusion of this thread:
>
> *the best new name for "IfThen intrinsic" is iif*

I have no problem with this conclusion, I use IIF() since years.
It exists in many other languages/tools, so it makes sense to use that.
To my knowledge it has no conflicts with existing unit identifiers in code we
distribute.

Michael.



More information about the fpc-pascal mailing list