Kinda, but not exactly, same kind of issue that is prevalent when learning private/protected/public (or the equivalents). They do not actually prevent code from outside accessing the bits you specify, like what you'd except if you think them like being similar to file permission bits. Rather they are hints for the type system and usually invisible at runtime.
In the same way, scopes do not actively prevent code from outside accessing the variables within. Rather they are hints for the compiler that these variables are associated with these bits of code, and usually on runtime they are just organized in most efficient way rather than enforcing the scope boundaries.
In the same way, scopes do not actively prevent code from outside accessing the variables within. Rather they are hints for the compiler that these variables are associated with these bits of code, and usually on runtime they are just organized in most efficient way rather than enforcing the scope boundaries.