Substitute Vector2.x and Vector2.y by using function parameter?

Is there a way to do

function ( w )
{
	transform.position.w + myVector2.w;
}

so that I can add the x parameters of some variables, then add the y values of the variables by passing in what portion of the vectors I want to add?

function Add (v1 : Vector2, v2 : Vector2, i : int) : float {
	return v1[i] + v2[i];
}

x = 0, y = 1. (Also works for Vector3 where z = 2, and for Vector4 where w = 3. In other words v1[0] is the same as v1.x, and v1[1] is the same as v1.y.)

–Eric

Wow you’re all over this place with the answers! Thanks for the help.