Part of the reason OP liked the `if assignment` was to avoid polluting the higher-level scope with a variable that is only needed during the if statement.
Your solution fixes the error, but at the cost of losing the upside OP saw.
Your solution fixes the error, but at the cost of losing the upside OP saw.
let {
var err := error
scoped code
} {
var err error
scoped code
}