When posting code, please use code tags: Using code tags properly
Like so:
public Camera mainCamera;
public Camera hoodCamera;
public KeyCode switchKey;
...
if(Input.GetKeyDown(switchKey))
{
mainCamera.enabled = !mainCamera.enabled;
hoodCamera.enabled = !hoodCamera.enabled;
}
And which part in particular do you want to know how it works?