Array of Cameras

Is it possible to have an array of cameras, that when a button is pressed it will go to the next camera? I have code that works for switching between 2 cameras but i want to add another 1 or maybe 2 and having them in an array would look better I think. The code I have for switching between my 2 cameras is:

    public Camera thirdPersonCamera;
	public Camera topDownCamera;
	
	// Use this for initialization
	void Start () {
		thirdPersonCamera.camera.enabled = true;
		topDownCamera.camera.enabled = false;
	}
	
	// Update is called once per frame
	void Update () {
		if(Input.GetKey (KeyCode.F1)){
			thirdPersonCamera.camera.enabled = true;
			topDownCamera.camera.enabled = false;
		}
		
		if(Input.GetKey(KeyCode.F2)){
			thirdPersonCamera.camera.enabled = false;
			topDownCamera.camera.enabled = true;
		}
		
	}

Thanks for any help

One way could be:

Create a array for your cameras

public Camera[] cameras;

Create a array for your camera keys

public KeyCode[] cameraKeys = new KeyCode[]{ KeyCode.F1, KeyCode.F2, KeyCode.F3 .....};

loop through the keys like

for(int i = 0; i < camerKeys.Length; i++)
{
 if(Input.GetKeyDown(cameraKeys[i]))
 {
   for(int j = 0; j < cameras.Length; j++)
   {
    cameras[j].enabled = (i == j) ? true : false;
   }
 }
}

Your key array should match your camera array in size.
The ‘camers[j].enabled…’ line just sets enabled to true for one of the camers and to false for the others.

//Code untested

Thank you very much, works great