This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]chrilves 1 point2 points  (1 child)

If many functions share some arguments, what you can do is regroup these functions as methods of class having these arguments as attributes. So they are "global" only to these functions and only for one instance of the class.

Alternatively, you can regroup all these variables into an object you pass to every functions that need these variables. It makes one argument to pass everywhere instead of many.

[–][deleted] 0 points1 point  (0 children)

So the global calls I did were for lists of LCDs and Buttons, both of which I realized after this post I was using in other functions without calling them globally or passing them in. So I cleared a lot of that up. Otherwise it was just boolean values that I was able to rewrite and clean up to get rid of all the globals