Code has been added to clipboard!

Inner and Outer Variables in Solidity

Example
pragma solidity >=0.5.0 <0.7.0;

contract C {
    function f() pure public returns (uint) {
        uint x = 1;
        {
            x = 2; // this will assign to the outer variable
            uint x;
        }
        return x; // x has value 2
    }
}