Return value from a scope #7836
Unanswered
rccarlson
asked this question in
Language Ideas
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I've been learning F# and I've really enjoyed the scoped definitions available there. For example:
This would set
sum
to equal3
, while leavinga
andb
out of scope for any other code. I would love to have something like this for C#. My vision for this would be something like:This would have the same behavior as:
This would be very helpful for cleaning up working variables (such as
StringBuilder
s or iterators) and only holding on to the resulting valueBeta Was this translation helpful? Give feedback.
All reactions