There are 5 kinds of variables in Arma: private, private special, public local, public local special, public global. Each variable kind has own scope of existence you have to be aware of.
Private variables
The engine automatically interprets any variable name that starts with underscore as a private variable. You can use standard alphanumeric characters A to Z, a to z, 0 to 9 and _ for variable names. So _hello, _HELLO_WORLD2000, _____hello, _123, ____123_______hello are all valid and will all be considered private. Private variables are created where they are defined within a scope and get deleted once the scope is finished. Therefore any private variable defined first time within the scope will be undefined outside of the scope.
If you have child scope within your parent scope in which your private variable is defined, it will also be defined inside the child scope and the child of that child and so on. So if you change private variable within child scope and want its value in parent scope make sure it is defined in parent scope first.
But what if you want to make sure the value of a variable you are using within a scope is exclusive to this scope? Then you need to use private command. You can either define a single variable as private or an array of variables.
Using private command ensures that if there is a variable of the same name defined in parent scope, it will not be affected and that the variable that you just explicitly made private is undefined within the child scope until you define it.
Private special variables
Have a look at the list of private special variables. With certain commands the engine would automatically create a special variable that would only exist within the scope of that command then assign special value to it also depending on command. Because the engine will first use private command on those special variables, they will exist only within the scope of the command code.
As you can see in the above example _x in the parent loop is not the same _x in the child loop. This makes it safe to have nested loops. If however you need the value of the parent _x inside child loop you can assign _x to another variable then pass it into the child loop.
There is nothing much else to say about private special variables except that to be on a safe side you should avoid making your own variables with the same names. Also to summarise this part, it will not hurt to take extra precaution and explicitly set the variables of your script of function as private (unless there is a reason not to), especially if your function is called using call command. The private variable extractor is just the tool for the job.
This is it for Part 1, looks like it is going to be Part 2.
Enjoy,
KK