> 
> **Possible Duplicate:**  
> 
> [Variable declarations following if statements](https://stackoverflow.com/questions/2496589/variable-declarations-following-if-statements)  
> 
> [Why this compile error](https://stackoverflow.com/questions/8823427/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?