Are you sure? I thought ALL variables (whether public or private) had to be defined in init.sqs or somewhere in the script before they can be used. In fact, I'm pretty sure some of my scripts in my missions wouldn't work until I defined the variables.
-Student Pilot
Like I said, that depends on how you use the variable. If you want to know what a variable is equal to, for example:
? Variable1 == 3
You would need to define Variable1 as a number or else OFP will make define it as "scalar bool array etc...." or some form of that, and OFP won't know its supposed to be a number, so it will give you an error (but won't really effect anything). If you were doing something like:
Variable1 = Variable1 + 1
Then you would need to define variable1 somewhere first, or else OFP will be adding a number to nothingness and will confuse itself. If you did this:
? Variable1
Then you don't need to set it to false first, because if you translate this literaly, it means "If Variable1 is true", so its not checking if its false, so it means Variable1 can be equal to ANYTHING and this line will still function currectly. All you need to do is set it to true at ANY time and OFP will pick up on this change. Its like this, if you are creating a new unit:
"SoldierWB" createunit [<yadda yadda>,"NewSoldier = this",<yadda>]
Now suppose you had a script that used NewSoldier:
? NewSoldier <something something>
If this script ran BEFORE the unit was created, OFP would be like "What the heck is NewSoldier?". If you suddenly created NewSoldier, OFP will be like "Oh.... there he is!" and now it works. Same thing applies to true/false variables. I hope that explains it, I can't word it any simpler than that :-\