Variable location | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Variable location

Does the place of variable matter? for instance I always get confused where I should place the variable inside or outside the function? and befor or after print stetment?

1st Dec 2022, 12:48 AM
Mohamad Karou
Mohamad Karou - avatar
1 Respuesta
+ 3
variables inside a function can accessed only from inside the function, if put them outside then you can access them from more functions. To print a variable it need to created first so you always must set the variable you want to print and after call print function
1st Dec 2022, 1:45 AM
Giannis
Giannis - avatar