Possible Duplicate:
Variable declarations following if statements
Why this compile error
I am getting the error "Embedded statement cannot be a declaration or labeled statement" because I had a declaration of a variable following an if statement with no brackets. Anyway, that's the background, which brings me to this.
The following code is illegal
if (true) int i = 7;
However, if you wrap that in brackets, it's all legal.
if (true){ int i = 7;}
Neither piece of code is useful. Yet the second one is OK. What specifically is the explanation for this behavior?