Is copilot wrong about out var
scope?
#9458
Answered
by
jnm2
The-Futurist
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
jnm2
Jun 17, 2025
Replies: 2 comments
-
It's almost right! This is how you use braces to limit the scope: {
if (context.TryGetNode<ElseBlockContext>(out var tempBlock))
{
var else_block = ...
}
} // tempBlock ceases to exist beyond this point |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
CyrusNajmabadi
-
Thanks, I'm glad I asked now, I assumed it was just mistaken as it sometimes can be with stuff like this. |
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
It's almost right! This is how you use braces to limit the scope: