I agree in most cases you should avoid globals (implicitly or explicitly declared) as they are rarely needed and can cause confusion.

There are however two occasions that I use them.

The first is where I want to keep state information between calls to a function. There is currently no implementation of static variables in KiXtart, so no way to maintain information between calls.

The second instance is where I need to save processor time and/or memory. Where I need to pass very large arrays to functions I will declare them as global. This is because variables passed to functions are passed by value, so there is the cost in processor time and memory in creating a local copy of the variable.

Using a short form hungarian notation such as prefixing global variable names with a "g" ensures that there will be no clash with local variables.