[Solved]: Difference between free and global variables

Problem Detail: Is there any difference between free variable and global variable? Or they are just synonyms? In which situations I should use one or another?

Asked By : rook

Answered By : Gilles

They don’t play in the same category. The notion of free variable is relative to a scope. If a variable is present in a term (i.e. a subprogram) and its scope is larger than this term, then the variable is said to be free in that term. A global variable is one whose scope is the whole program, or the whole file, or the whole module, or whatever scope is called “global” in the programming language you’re considering.
Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/14038  Ask a Question  Download Related Notes/Documents