Why are out parameters inside an if statement condition not local to the if block? [Answered]

if (dictionary.TryGetValue(key, out var val))
{

}

// why can I access val here?


Is this because of how it ends up compiling val above the if statement?
Was this page helpful?