How can i modify a global variable with a function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i modify a global variable with a function

im trying to make a function called punch that takes 30 from the variable vida that has 100

18th Sep 2017, 3:00 PM
ketze
ketze - avatar
1 Answer
+ 3
https://stackoverflow.com/a/423596 Covers it better than I'd typed. Basically, global keyword to change, don't need the keyword to read.
18th Sep 2017, 3:04 PM
Kirk Schafer
Kirk Schafer - avatar