Rotating A Camera Back and Forth

Hello! So as the title says I want to rotate a camera back and forth along its z axis. I don’t want to use iTween because I already tried that but it turned out kind of weird. Anyways, I made this script that I thought would work but it will only bump back my camera only once then it keeps rotating the other way forever. Here’s the script:

private var left = false;
private var right = true;

function Update ()
{
		if(left)
		{
				transform.Rotate(0,0,3*Time.deltaTime);
		}
		
		if(right)
		{
				transform.Rotate(0,0,-3*Time.deltaTime);
		}
		
		if(transform.localEulerAngles.z > 4 && transform.localEulerAngles.z < 350)
		{
				left = false;
				right = true;
		}
		
		if(transform.localEulerAngles.z < 356)
		{
				left = true;
				right = false;
		}
}

So if you have any ideas how to make it keep bumping the camera around it would be great!

What about something like this:

function Update ()
{
    transform.rotation = Quaternion.Euler(0,0, Mathf.Sin(Time.realtimeSinceStartup) * 70); 
}

To get broader angle change the constant.
If you want it to swing faster you can update to:

transform.rotation = Quaternion.Euler(0,0, Mathf.Sin(Time.realtimeSinceStartup * 2) * 70);