This is usually called "inline if". Maybe call it "inlineif" or "iif", e..g
x := iif (a < 3, 1, 2) or even x := iif a < 3 then 1 else 2; On Mon, Feb 1, 2016 at 10:26 AM, Maciej Izak <hnb.c...@gmail.com> wrote: > 2016-02-01 8:59 GMT+01:00 Marco van de Voort <mar...@stack.nl>: > >> The only really bad thing is the name, as Florian already said, with the >> versions in strutils and math. The clash with delphi compatible functions >> should be avoided. > > > +1 . IfThen instricit is IMO very bad idea. I have a lot of "IfThen" from > math and strutils modules. > > IfThen from System totally breaks the compatibility :\ . C'mon Sven. In > one field you're rigorously but in something like this you're liberal > (braking/dangerous change / for existing code base). > > If i understand correctly "ThenExpr" is executed only when "Condition" is > true and "ElseExpr" is executed only when "Condition" is false. For > standard "IfThen" from Math and StrUtils "ThenExpr" and "ElseExpr" is > executed before IfThen is called. > > for me different syntax for System.IfThen is required (fpIfThen ? or > http://docs.elementscompiler.com/Oxygene/Expressions/If/ ). >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal