I think because the compiler isn’t able to figure out that the See below for the correct answer.i==1 branch of the if (which defines b) always executes first, so at compile-time it thinks that it’s possible that b is not defined yet in the else branch.
2 Likes