Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

environmental variables vs. global variables

I am pretty new to shell scripting and python. While I was reading the materials, I saw the term "environmental variable" in shell and "global variable" in python. I kind of feel these two words mean the same but not sure. Can anyone explain their difference in more details.

Thank you in advance.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

They don’t mean the same. "global" is a programming language idea, "environment variable" is an operating system idea. So, they’re not really related, and conceptually quite different!

Since you now know that, and both terms are easily researchable ("environment variable" on wikipedia, global variable on the Python.org language tutorial), I’m not going to write an introduction into two completely unrelated topics here – I simply couldn’t put it any better.

Note that as Python beginner, you will not have to deal with explicitly global variables often. In fact, global is usually a keyword you should avoid, it often is a sign that you forgot to correctly think of what goes in and out of a function.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading