﻿# V1048\. Variable 'foo' was assigned the same value\.

The analyzer has detected a case where a variable is assigned the value already stored in it\. Such an assignment is very likely to be a logic error\.

Consider the following example:

```cpp
int i = foo();
if (i == 0)
{
  i = 0;      // <=
}
```

The reported assignment does not change the value of the variable, and the code is apparently faulty\.

The analyzer can also detect cases where exact values of variables are unknown:

```cpp
void foo(int x, int y)
{
  if (x == y)
  {
    x = y;    // <=
  }
}
```

Even though the variables 'x' and 'y' can take any values, the assignment is still meaningless because of the earlier condition checking these variables for equality\.