[fpc-devel] Proposal: IIF - IfThen Cond True False

kingbizugo at gmail.com kingbizugo at gmail.com
Wed Jan 12 07:28:19 CET 2011

I come here humbly to ask for a new implementation, the IIF ?:, the IIF 
is a shortcut that make the coding a little faster, it works by 
returning a true or a false part of a condition, a more detailed 
information can be found there: http://en.wikipedia.org/wiki/%3F:

*PHP and C++ implementation:* Value *=* condition *?* value if true *:* 
value if false;
*Pascal implementation:* Value := IfThen(Condition, TruePart, FalsePart);

*function IfThen(Condition: Boolean; IfTrue, IfFalse: X): X; overload;
     if Condition then Result := IfTrue else Result := IfFalse;
The problem: we have to do *one function for every type*, on the C and 
PHP method is is *globally*
If we want one for Integer we must declare one for it, if we want one 
for X we need to declare it...

I want to know from you, what you would think about it on FPC? I don't 
belive that it is a hard feature to implement and is helpfull. I'll be 
waiting for your response!

*If this is not the right mailing list for proposals, then I apologize.
Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20110112/48698eb1/attachment.html>

More information about the fpc-devel mailing list