Cycle through array

Im sure this is very simple, I just want to cycle through a small array. SO lets just say I have 3 numbers, 1,2,3. I start on 1, and if I click, I go to 2. Click again, I go to 3. Click again, I go to 1, ect…

C#:

int [] array = {1,2,3};
int arrayPos = 0;

void Update () {
	if (Input.GetMouseButtonDown (0)) {
		Debug.Log (array[arrayPos]); //Prints current value to console.
		if (arrayPos >= array.Length -1) {
			arrayPos = 0;
		}
		else {
			arrayPos += 1;
		}
	}
}

JS:

var array : int [] = [1,2,3];
var arrayPos : int = 0;

	function Update () {
		if (Input.GetMouseButtonDown (0)) {
			Debug.Log (array[arrayPos]); //Prints current value to console.
			if (arrayPos >= array.Length -1) {
 				arrayPos = 0;
			}
			else {
				arrayPos += 1;
			}
		}
	}