﻿# V8001\. Identical sub\-expressions to the left and to the right of the 'foo' operator\.

The analyzer has detected a code fragment that may contain a logic error\. The code contains a binary expression in which the left and right subexpressions are identical\. The operator of such an expression can be one of the following: <, \>, <\=, \>\=, \=\=, \!\=, &&, \|\|, \-, /, &, \| or ^\.

The example:

```cpp
func ConvertRGB(rgb RGBContainer) {
  if rgb.R > 1 && rgb.G > 1 && rgb.R > 1 {
    ....
  }
  ....
}
```

In this case, the condition contains two `rgb.R > 1` subexpressions that are combined using the `&&` operator\. This error was caused by inattention, as there is no reason to use the same subexpression multiple times via the `&&` logical operator\.

The fixed code that will not trigger the analyzer is as follows:

```cpp
func ConvertRGB(rgb RGBContainer) {
  if rgb.R > 1 && rgb.G > 1 && rgb.B > 1 {
    ....
  }
  ....
}
```

The analyzer compares blocks, considering the arrangement of the expression parts relative to the operators\. The analyzer will also detect the error in the following code example:

```cpp
if len([]rune(name)) > maxlength && 
   maxlength < len([]rune(name)) {
  ....
}
```