The scope of a variable declared in the declaration part of a block, is valid from the point of declaration until the end of the block. If a block contains a second block, in which the identifier is redeclared, then inside this block, the second declaration will be valid. Upon leaving the inner block, the first declaration is valid again. Consider the following example:
In this example, inside the procedure, X denotes an integer variable. It has its own storage space, independent of the variable X outside the procedure.