How to make player rotate using the If Else Loop?

I was trying something like this:

if (plInput.jump == true)
{
if("If players Quaternion range is < 0f")
{
Player will instantly make a 180 degree turn.
}
else if("If players Quaternion range is > 0f")
{
Player will instantly make a 0 degree turn.
}
}

But I don’t know what is the proper way to code it. Sorry if I can’t explain it well.

You can put a direction to face into LookRotation and get a quaternion that fits into transform.rotation. Don’t forget that turning 180 degrees is the same as the inverse of the current transform.forward so you could get that direction by just putting it as (-transform.forward.)

If you know the degrees you want to turn but not the direction, you can use AngleAxis to return the rotation you want.

If you have a specific object you want to face, you can use LookAt to just input the object transform you want to face towards.