Should we allow nullable boolean ternary operator and let it return null value? #9531
Unanswered
Thaina
asked this question in
Language Ideas
Replies: 2 comments 4 replies
-
This would be a massive breaking change for existing code. Also there is no syntactic difference making it harder to read. IMHO |
Beta Was this translation helpful? Give feedback.
3 replies
-
Using existing mechanisms, these could be written like int? i = maybeCondition switch { true => 0, false => 1, null => null };
long l = maybeCondition switch { true => 1, false => 0, null => -1 };
string s = maybeCondition switch { true => "yes", false => "no", null => "maybe" }; |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Beta Was this translation helpful? Give feedback.
All reactions