Vote UpVote

iif… anonymous expression parameters?

DelphiTools – While making the rounds of “compiler magic” functions, I bumped on iif, the ternary operator, which f.i. Prism, VB and other support. Which looks like: function iif (boolean; expressionIfTrue; expressionIfFalse) : value; One part of the magic goes to the type-checking, the other part which interests me here, is that in a regular function call, all parameters are evaluated once before the call is made. For iif, either expressionIfTrue or expressionIfFalse is evaluated, but not both, this means you can have such code as: v := iif( Assigned(myObject); myObject.VirtualGetMethod; zero ...
Favorite? Off-Topic? Eric @ 2010-11-29 11:20


Visits: 584
Votes: 3
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Daniele Teti
Primoz Gabrijelcic
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News


Please login or register to use this functionality.
(click on this box to dismiss)