arr.push arr. add

Hi all,

Just want to make sure, their exactly the same?

http://unity3d.com/Documentation/ScriptReference/Array.html

Thanks,
Ray

Yep

Not quite; you can do this with Push:

var myArray = new Array ("a", "b", "c", "d");
if (myArray.Push("e") > 4) {
     print ("Hey, stop putting so much stuff in the array!");
}

But you can’t do that with Add, since Add doesn’t return anything but Push returns the length of the array.

–Eric