Global variables are messy and you can easily get into trouble with them by accidentally changing their values in called functions. In your main code you'll be expecting the value you started with, but you'll actually have a completely different value. Passing values to functions is much better coding practice.
Global variables are messy and you can easily get into trouble with them by accidentally changing their values in called functions. In your main code you'll be expecting the value you started with, but you'll actually have a completely different value. Passing values to functions is much better coding practice.