Let’s talk about scope
In general, the scope in a programming language affects the visibility of fields/ properties in a class/ module or of the arguments passed or the variables declared inside a function. There are two main categories of scope in the modern languages:
Read the complete article
The block scope, where for example a variable is only visible inside an if condition or a for loop, when this variable is declared inside this condition. C# uses this type of scope.
The function scope, where a variable is visible and can be used inside the whole function. The variable remains visible only inside the function and not outside of it.