Arithmetic on an array

Another mel newbie question here I'm affraid. I'm having trouble working out how to perform arithmetic functions on all the elements of an array. I'm hoping that there's some simple syntax or whatever that I'm missing out on. Basically I'm wanting to define a new array from an existing array, but with the values of the new array having had an arithmetic function performed, without having to go through and perform the function on each element individually.
Say, <2,3,4,5>, from an existing array of <1,2,3,4>.

cheers
TomB

I don't belive you can simply add an array with some number ($myArray = $oldArray+3), but a simple for loop will do the trick.
//----------start
int $myArray[]={1,2,3,4,5};
int $newArray[];
for($i=0;$i{
$newArray[$i]=$myArray[$i]+1;
}
//--------------end

Hope that helps
--g

Be careful not to confuse an array

float $myArray[] = {1, 5, 10};

with a vector

vector $myVector = <>;

Vectors can be added by doing this:

$newvector = $myvector + $myvector;

Arrays have to be added with a loop.

There may be times that you need to convert from a vector to an array, or vice versa. It's a shame that there's no built-in way to do this in Maya. Vectors are more commonly seen in dynamics and arrays are more commonly seen in manipulating objects, but that isn't necessarily always the case.

-- Mark

cheers guys, both replies are just what I needed.
Mark, thanks for clearing up my slight confusion between arrays and vectors.
cheers
TomB