How do I make many object move when I click a GUI button? I want the objects move upward.

How do I make many object move when I click a GUI button? I want the objects move upward.

Assume you have a list of gameObjects, assume C# and upward is Y

OnGUI () {
// if button is pressed, do something:
if (GUI.Button(new Rect(x,y,w,h),"ClickMe")) {
doSomething() 
}
}

private void doSomething() {
 for(loop through GameObject list) {

 Vector3 newPos = myList[loop_index].gameobject.transform.position;
 myList[loop_index].gameObject.transform.position = new Vector3 (newPos, newPos+10, newpos);

}
}