How to set a limit for maximum camera scrolling?

I managed to make my camera scroll when the “up”, “down”, “left” and “right” key is pressed, now I would like to set a limit for the maximum unit that the camera can scroll in the scene, how do I go about doing it, can anyone kindly help me?

void OnGUI ()
{
	if ( Input.GetKey("up") )
	{
		Camera.main.transform.Translate( Vector3.up * Time.deltaTime * scrollSpeed, Space.World );
	}
		
	if ( Input.GetKey("down") )
	{
		Camera.main.transform.Translate( Vector3.down * Time.deltaTime * scrollSpeed, Space.World );
	}
		
	if ( Input.GetKey("right") )
	{
		Camera.main.transform.Translate( Vector3.right * Time.deltaTime * scrollSpeed, Space.World );
	}
		
	if ( Input.GetKey("left") )
	{
		Camera.main.transform.Translate( Vector3.left * Time.deltaTime * scrollSpeed, Space.World );
	}
}

Add a condition to each one of your ‘if’ statements. Decide what is the maximum and minimum values for both up/down and left/right. The ‘if’ statements would look something like:

 if ( Input.GetKey("up") && (transform.y <= maxY))
...
 if ( Input.GetKey("down") && (transform.y >= minY))
...
 if ( Input.GetKey("right") && (transform.x <= maxX))
...
 if ( Input.GetKey("left") && (transforum.x >- minX))

Where minX, minY, maxX, and maxY are variables you defined and set.