﻿# V7020\. Suspicious code formatting\. Curly brackets may be missing\.

The analyzer has detected a potential error: the formatting of the code following the control statement does not align with the program's execution logic\. Braces may be missing\.

The example:

```cpp
if (a == 1)
  b = c;
  d = b;    // <=
```

In this example, the `d = b;` statement is executed regardless of the condition, because if there is no block following the control statement, its body consists only of the first expression\. However, the formatting indicates that the `d = b;` statement was expected to execute only if the `a == 1` condition was true\.

The [Google JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html#formatting-braces-all) recommends using braces for all control statements, even those with a single operation in their body\. This prevents confusion caused by misleading code\.

The fixed code options:

```cpp
// Option N1
if (a == 1) {
  b = c;
}
d = b; 

// Option N2
if (a == 1) {
  b = c;
  d = b;
}
```

Misleading code may also look like this:

```cpp
if (a == 1) b = c; d = b;
```

In this case, the `d = b;` statement is also executed regardless of the condition\. 

Possible ways to fix the issue:

```cpp
if (a == 1) { b = c; d = b; }

if (a == 1) { b = c; }
d = b;

if (a == 1) b = c;
d = b;
```

**Note**\. The analyzer treats `if`, `for`, and `while` as control statements\.