Generators versus global variables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

Generators versus global variables

Do generators allow the iteration of global variable for ie (i) without changing the value of the global variable that has been set?

31st Jan 2017, 3:16 AM
Donnell Dammond
Donnell Dammond - avatar
1 Answer
+ 5
Global variables are exactly that, global. Changing them at any point in your program changes them in the global scope.
12th Feb 2017, 5:18 PM
Aidan Haddon-Wright
Aidan Haddon-Wright - avatar