In modern programming languages, it is usually possible to say things like:
DECLARE @x int
SELECT @x = 14
And if you now add:
after END, you get a compilation error, as @x is only visible within the block where it was declared.
Not so in T-SQL, where the above is perfectly legal. That is, you can refer to the variable outside the block where it was declared.
There are two advantages with the more modern approach.
1) If you declare a variable to be used only in a block controlled by an IF statement, and then you mistakenly refer to it outside the IF block, you get a compilation error.
2) It is common in a WHILE loop to have one or more work variables. In order to be sure that values from the previous iteration do not linger, you need to explicitly initiate the variables in the beginning of the loop, and if you have lots of variables, you can easily miss one, leading to hard-to-find errors.