﻿# V8033\. Two similar code fragments were found\. A second fragment may contain a typo\.

The analyzer has detected a possible typo: the code contains an identifier \(local variable, field, parameter, or function\) that should likely be replaced with a different identifier\. This finding is based on the presence of a structurally similar code snippet that may have been used as a template when creating the current one\.

The example N1:

```cpp
if currentUser != nil 
{ 
  updateProfile(currentUser)
  sendNotification(currentUser)
} 
if newUser != nil 
{ 
  updateProfile(newUser)
  sendNotification(currentUser)
}
```

In the second `if` statement, the `currentUser` variable should be replaced with `newUser`\. The code can be fixed in the following way:

```cpp
if currentUser != nil 
{ 
  updateProfile(currentUser)
  sendNotification(currentUser)
} 
if newUser != nil 
{ 
  updateProfile(newUser)
  sendNotification(newUser)
}
```

The example N2:

```cpp
if FindMin(xCoords) < FindMin(yCoords) {
  minBoundary = FindMin(xCoords)
} else {
  minBoundary = FindMin(yCoords)
}

if FindMax(xCoords) < FindMax(yCoords) {
  maxBoundary = FindMin(yCoords)          // <=
} else {
  maxBoundary = FindMax(xCoords)
}
```

In the `then` branch of the second `if` statement, `FindMax` should be called instead of `FindMin`\. The code can be fixed in the following way: 

```cpp
if FindMin(xCoords) < FindMin(yCoords) {
  minBoundary = FindMin(xCoords)
} else {
  minBoundary = FindMin(yCoords)
}

if FindMax(xCoords) < FindMax(yCoords) {
  maxBoundary = FindMax(yCoords)
} else {
  maxBoundary = FindMax(xCoords)
}
```