[Tutor] global is bad but ...

Michael H. Goldwasser goldwamh at slu.edu
Wed Nov 14 04:25:52 CET 2007

>    >     okay, i tried. so why are globals bad and what problems
>    > do they solve?

The biggest complaint I have with the original example is that you've
writen code to "do stuff" with array G, yet that code cannot directly
be used to do the same stuff to some other array.  In this sense, the
code is not reusable.  If it accepted G as a parameter, then it would
be more general.

The main advantage of globals is convenience (for example, if all you
care about is getting this particular program working as soon as

With regard,

More information about the Tutor mailing list