News

A function scope is in a way also a block scope, so let and const would behave the same way they did in our previous examples. However, function scopes also encapsulate variables declared with var.
Pre-standard C++ had quirky scope behavior similar to your first example - variables declared specifically in a for loop's initializer statement remained in scope through the end of the block.