Overriding a variable declared in an outer scope can strongly impact the readability, and therefore the maintainability, of a piece of code. Further, it could lead maintainers to introduce bugs because they think they're using one variable but are really using another.

## Noncompliant Code Example

    function foo() {
      let x = bar(1);
      if (x > 0) {
          let x = bar(2); // Noncompliant
          console.log(x);
      } else {
         console.log("Wrong Value");
      }
    }

## Compliant Solution

    function foo() {
      let x = bar(1);
      if (x > 0) {
          let y = bar(2);
          console.log(y);
      } else {
         console.log("Wrong Value");
      }
    }

## See

- MISRA C:2004, 5.2 - Identifiers in an inner scope shall not use the same name as an identifier in an outer scope, and therefore hide that identifier
- MISRA C++:2008, 2-10-2 - Identifiers declared in an inner scope shall not hide an identifier declared in an outer scope
- MISRA C:2012, 5.3 - An identifier declared in an inner scope shall not hide an identifier declared in an outer scope
- CERT, DCL01-C. - Do not reuse variable names in subscopes