What programming language are we talking about?
What does "exclude" mean to you?
For instance, most programming languages have a scope for a variable. Outside of that scope, it does not exist.
Let's consider the following C code:
#include <stdio.h>
void PrintName(const char * name)
{
printf("name: %s\n", name);
}
int main()
{
const char * myName = "John Doe";
PrintName(myName);
return 0;
}
The scope of the variable myName is limited to the main() function. I could not reference it in the PrintName() function for instance.
Similarly, the scope of the variable name (, which is a function argument) is limited to the PrintName() function, it can only be accessed there.
Scopes are bound by opening and closing curly braces: { and }. So the body of every loop and if statement is also a new scope (even if you don't use the curly braces as the statement there is just a single line).
For instance, the following snippet causes a compilation error as the variable i is only visible within the for loop:
for (int i = 0; i < 10; i++)
printf("i: %d\n", i);
printf("i's final value: %d\n", i);
I hope this helps.