SCOPE Flashcards
What is a block ?
A block is the code found inside a set of curly braces {}. Blocks help us group one or more statements together and serve as an important structural marker for our code.
What are global variables ?
In global scope, variables are declared outside of blocks.
Because global variables are not bound inside a block, they can be accessed by any code in the program, including code in blocks.
What is the global namespace?
When you declare global variables, they go to the global namespace. The global namespace allows the variables to be accessible from anywhere in the program. These variables remain there until the program finishes which means our global namespace can fill up really quickly.
What is the global namespace?
When you declare global variables, they go to the global namespace. The global namespace allows the variables to be accessible from anywhere in the program. These variables remain there until the program finishes which means our global namespace can fill up really quickly.
What is the Scope pollution ?
Is when we have too many global variables that exist in the global namespace, or when we reuse variables across different scopes.
What is scope?
Scope refers to where variables can be accessed throughout the program, and is determined by where and how they are declared.
What is Global scope?
Global scope refers to the context within which variables are accessible to every part of the program.
What is block scope?
Block scope refers to the context within which variables are accessible only within the block they are defined.