-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Committee-ReviewedPS-Committee has reviewed this and made a decisionPS-Committee has reviewed this and made a decisionIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugWG-Languageparser, language semanticsparser, language semantics
Milestone
Description
C-style ternary conditionals would be a handy addition to the language.
For instance, instead of writing:
if ((get-date).tostring("ss") % 2) { 'odd' } else { 'even' }one could write:
(get-date).tostring("ss") % 2 ? 'odd' : 'even'It would also relieve a long-standing disappointment:
At Microsoft, “to ship is to choose”. One of the things we were very disappointed in not being able to ship in V1.0 is a ternary operator.
From a PowerShell Team blog post dated 29 December 2006.
Related: implement null-coalescence and null-soaking and null-conditional assignments
dragonwolf83, rkeithhill, thezim, camilohe, KirkMunro and 44 moreLemminghExE-Bossfelixfbecker and Lemminghdzmitry-lahoda, bitdivine and ExE-BossExE-Boss
Metadata
Metadata
Assignees
Labels
Committee-ReviewedPS-Committee has reviewed this and made a decisionPS-Committee has reviewed this and made a decisionIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugWG-Languageparser, language semanticsparser, language semantics