in reply to Re: A cleaner way of scoping variables
in thread A cleaner way of scoping variables
If all those prints work, your code is essentially the same as when you just declare $bar before the if block.
Almost, but not quite. You could have code between the start of the if block and the $bar declaration that wasn't allowed to use $bar if using what the OP was asking for. I'm not saying that this is something I want, because as you say, it would be like a global except you can't use it above the statement. But I think that's the detail that the OP was thinking about.
ihb
Read argumentation in its context!
|
|---|