Ternary operator ?:

For C, C++ or C# developers, one of the most missed operator in Windows PowerShell v1.0 (current RTM) must have been the ternary operator. This is a shorthand notation (… ?: … ) typically used to compress if-else loop(s) into one (or more) statement(s).

Jeffrey Snover blogged about this and provided a link to Karl Prosser who contributed this time-saver at the Windows PowerShell team blog. Worth checking out not just for the ?: but also get to learn how to harness advanced PowerShell features!

No Comments »

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.