Skippable return #4173
-
UPDATE 2020-11-25 GMT+1: MAIN DISCUSSION:
...instead of...
...where...
...expects a tuple in the form of...
...and in my example, it is such that if isOk is false, the method should return. But that's just my use case. Another person may prefer to return when isOk is true. So, it depends on which way the eventual spec would choose. Please, I really think it's great. I had tweeted about the original text (already modified here) at... |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 22 replies
-
The code is not intuitive but I had to come up with something to demonstrate what I am trying to say and keep the narration as short as possible. |
Beta Was this translation helpful? Give feedback.
-
See: #3242 |
Beta Was this translation helpful? Give feedback.
-
It should be noted that other scenarios of the use of For example, if no return value is applicable, making the return skippable can be by just supplying a boolean value like...
|
Beta Was this translation helpful? Give feedback.
-
From the snippet you posted, it looks you're doing error handling by passing bools around. If this is the case, the idiomatic way to do this in .NET would be using exceptions. Then you can write: EnsureProcessExists(username);
LockProcess(username, someOtherParameter); The functional approach would be to use a |
Beta Was this translation helpful? Give feedback.
-
Also:
|
Beta Was this translation helpful? Give feedback.
See: #3242