Can anyone explain the local or global scope ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone explain the local or global scope ?

If i define the variable to first function and call them to another second function. Is this program can run or not?

4th Apr 2017, 4:46 PM
shivam saini
shivam saini - avatar
3 Answers
+ 17
In short, local variables are declared inside a function and can be accessed within that function only. And global variables are declared outside all functions so that each function can access it. See the following threads for details : https://www.sololearn.com/discuss/232350/?ref=app https://www.sololearn.com/discuss/102291/?ref=app
4th Apr 2017, 5:43 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 2
Ok.... I got it.. Thanku...😄
4th Apr 2017, 5:49 PM
shivam saini
shivam saini - avatar
+ 1
nahi bataunga
5th Apr 2017, 2:36 PM
shani tiwari
shani tiwari - avatar