camera swap

i looked around here and i figured out how to have two cameras. But i couldnt find the code to switch them mid gameplay by pressing a key. everything was in java script. How do i do that?

public Camera camera1;
public Camera camera2;
public string whichCamera = "2";





// Use this for initialization
void Start () {

	//camera1.camera.enabled = !camera1.camera.enabled;
}

// Update is called once per frame
void Update () {
	
	if(whichCamera == "1")
	{
		print("i'm in 1");
		camera1.GetComponent<Camera>().enabled = true;
		camera2.GetComponent<Camera>().enabled = false;
	}
	
	
	if(whichCamera == "2")
	{
		print("i'm in 2");
		camera1.GetComponent<Camera>().enabled = false;
		camera2.GetComponent<Camera>().enabled = true;
	}	

}

}

There are so many things wrong here that I am just going to redo your whole script.

public Camera camera1;
public Camera camera2;
void Start()
{
	camera1.enabled = false;
	camera2.enabled = true;
}
void Update()
{
	if(Input.GetKeyDown(Keycode.A)) //If A was pushed down on this exact frame
	{
		camera1.enabled = !camera1.enabled; //Set camera1.enabled to the opposite of what it is
		camera2.enabled = !camera2.enabled;
	}
}