When you talk about variables you can refer to their scope. Programmers refer to scope as "that part of the program where the variable can be referred to and used". This is a rather fraught business, but you should be able to make use of the program to the right to help you understand.

This program looks a bit strange, because the variable count is declared twice, once at the start of the body of the main function and again inside an internal block. When you run the program you will notice that the first count is declared as usual, but when we get to the second count we find another variable appearing (the second one is coloured cyan so that we can tell them apart).

When I perform statements which refer to the count variable you will see that the newest version of the variable (i.e. the cyan one) is changed and the outer one stays the same. We say that when the inner (cyan) version of count is in existence the outer (yellow) version is scoped out by the more recently declared one. Once I exit the block containing the inner count it disappears. This means that the final statement will affect the count variable declared in the outer block.

You may think that this is silly, in that all that scoping allows us to do is confuse ourselves by using the wrong variables. However, it is very useful. If a large number of programmers are working on a program it is important that they don't get confused and start using the same names for things. By using local variables a programmer can write code which makes sense to him or her and even use the same variable names as another programmer without any problems occurring. The bottom line is that if you create a local variable with a particular name you can be absolutely sure that you are not going to corrupt a variable with the same name which is declared somewhere else in your program.