I understand the scoping of variables in C#. But this is not what Stephane is asking for. He's asking for a way to specify a default var scoping in his program.
His problem occurs when he declares a var, then spells it differently when he uses it. Because he is not forced to declare all vars, he got bit by a typo.
He could also print out a var crossref report and look for typos there.
PF
>>I have never seen a language work the way you want. Specifying the scope of variables. However, maybe VFP needs an option like VB, Option Explicit. So all variables must be defined.
>>
>
>PMFJI - C++ and C# both work that way (eg. all variables are local). In fact, they take it one step further and scope only within there curly-braces {}
>
>eg.
>
>
>void SomeMethod(bool MyLogical)
>{
> if(MyLogical)
> {
> // MyInteger is only local within these curly-braces
> int MyInteger;
> }
>
> // MyInteger is out of scope here
>}
>
>
(On an infant's shirt): Already smarter than Bush