> I seem to be in the minority here, but I really don't like this
> solution. Pass the variable to the sub. Then, any form or module
> can use the sub not just this one form and this one variable. There
> is also no problem with changing the name of x and missing the
> reference to it in the module. The sub code is more robust and the
> code is more maintainable.
Actually I didn't write any of it - just for the record. :-)
You are probably right, but that wasn't the question. The question was
about how to use a global variable.
On occasions, I use global variables. They have their uses. Most of the
time I don't need them.
> ... There is also no problem with changing the name of x and missing the
> reference to it in the module.
Well, that's what compilers are for. If you change the name of x, then the
compiler will object.
Another problem with this test code is that it unloads the test form from
within the called subroutine - bad practice. But it is only a quick test
program, after all.