What is global keyword | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is global keyword

22nd Nov 2019, 10:54 PM
Umar Amour Amidu Ndongo
Umar Amour Amidu Ndongo - avatar
3 Answers
+ 5
Please specify the language in your question tags to improve context clarity 👍
23rd Nov 2019, 12:56 AM
Ipang
+ 2
the keyword “global” is used with a variable declaration in some languages, and makes the variable available in the entire code.
22nd Nov 2019, 11:22 PM
AngryBlackSheep
AngryBlackSheep - avatar
+ 2
In Python global keyword is used in code blocks of functions (or classes) to prevent variables that are defined in functions to be automatically destroyed. In code blocks of classes, instead of being destroyed the variables would only becomr available with the namespace of the class.
23rd Nov 2019, 1:21 PM
Seb TheS
Seb TheS - avatar