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

Michael Van Canneyt michael at freepascal.org
Tue Feb 2 10:07:35 CET 2016



On Tue, 2 Feb 2016, Maciej Izak wrote:

> we can even mix to gain more clear code:
>
> foo :=
>  if Condition1 then
>    iif(Condition2, ThenExpr1, ElseExpr1)
>  else
>    iif(Condition3, ThenExpr2, ElseExpr2);
>
> much more readable than:

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.

Michael.



More information about the fpc-pascal mailing list