How do I make a lerp stop?

I’m rotating something but I want it to go to 180 degrees once it reaches 170+

this is what I have:

		case 0:
			float roty = transform.rotation.y;
			camera.orthographicSize = Mathf.Lerp(camera.orthographicSize, 10, 1*Time.deltaTime);
			if(roty >= 0.9974061) {
				print ("sup");
				roty = 1;
			}
			transform.rotation = Quaternion.Lerp (transform.rotation, new Quaternion(0, 180, 0, 0), Time.deltaTime * 0.003f);
	
			break;

WHen it reaches if(roty >= 0.9974061) {
print (“sup”);
It tells me “sup” but it doesnt set the rotation to 1.

roty = 1 will only set the float roty to 1, it won’t actually change the rotation. Instead of the line roty = 1, you should put transform.rotation.y = 1;