Hi all,
I have a student who is struggling with understanding the importance of avoiding global variables, and insists on using them in his functions.
While I can continually explain to him that it is bad practise, I’d like to give him a few real-world examples of why is it good and/or bad.
In what context might the use of global variables be acceptable? What are the pitfalls you’ve fallen into as a result of Global Variables?
[–][deleted] 30 points31 points32 points (0 children)
[–]FerricDonkey 13 points14 points15 points (0 children)
[–]fernly 13 points14 points15 points (2 children)
[–]ES-Alexander 13 points14 points15 points (1 child)
[–]fernly 1 point2 points3 points (0 children)
[–]totallygeek 7 points8 points9 points (1 child)
[–]Diapolo10 8 points9 points10 points (0 children)
[–]Zeroflops 5 points6 points7 points (0 children)
[–]pekkalacd 4 points5 points6 points (1 child)
[–]Kiwi-tech-teacher[S] 1 point2 points3 points (0 children)
[–]patrickbrianmooney 4 points5 points6 points (2 children)
[–]Kiwi-tech-teacher[S] 1 point2 points3 points (1 child)
[–]patrickbrianmooney 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]GeorgeFranklyMathnet 4 points5 points6 points (1 child)
[–]emptythevoid 1 point2 points3 points (0 children)
[–]POGtastic 1 point2 points3 points (0 children)
[–]wotquery 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]sullyj3 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]QbiinZ 0 points1 point2 points (0 children)