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
C-style ternary conditionals would be a handy addition to the language.
For instance, instead of writing:
one could write:
It would also relieve a long-standing disappointment:
From a PowerShell Team blog post dated 29 December 2006.
Related: implement null-coalescence and null-soaking and null-conditional assignments