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

Maciej Izak hnb.code at gmail.com
Tue Feb 2 10:29:46 CET 2016


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*

unless someone has a good opposite arguments? Pros for iif:

- no conflicts with existing RTL code base (in this matter much much better
than IfThen)
- compatible with existing pascal solution (Oxygene)
- short and logical name

Cons:
- a little different behavior than in other languages (but still compatible
with Oxygene)
- I like &if ;)

-- 
Best regards,
Maciej Izak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160202/40f68abf/attachment.html>


More information about the fpc-pascal mailing list