PDA

View Full Version : Initialization code


solalmighty
05-31-2001, 05:42 PM
Can someone explain to me what the initialization code is and does and when it does it? Thanks in advance.

Jesse
06-01-2001, 03:49 AM
Initializing is defining a variable/array/whatever and setting it's value at the outset.

So you can say:

myArray = new Array()

Then later on (on another frame perhaps) you can say:
myArray[0] = "Jesse"

that doesn't count as initializing because you've defined it but you don't give it a value u til later. If you did both actions on the same frame though:

myArray = new Array()
myArray[0] = "Jesse"

That would be considerred Initializing a variable.

Personally I though the new Array() bit was initializing until last week when I read Teach Yourself C++ in 21 days and found that it doesn't count... but that's off the point.