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

Marcos Douglas md at delfire.net
Tue Feb 2 12:24:27 CET 2016


On Tue, Feb 2, 2016 at 7:49 AM, Michael Van Canneyt
<michael at freepascal.org> wrote:
> It is not a statement, it is an expression.
>
> I prefer
>   x := iif Obj = nil then 0 else Obj.Value;
> over
>   x := if Obj = nil then 0 else Obj.Value;
>
> Because it clearly differentiates between if (a statement) and iif (an
> expression)
>
> So the iif in either functional or expression form has my vote.

+1

And why not use 'inline'?

  x := inline if Obj = nil then 0 else Obj.Value;

It's not necessary add one more keyword like "iif", I think.

Best regards,
Marcos Douglas



More information about the fpc-pascal mailing list