What do I return if my raycast function doesn't hit anything?

I’m trying to use a raycast to check if there’s anything directly in front of the mouse at a certain range:

RaycastHit FireRay(float rayRange){

		RaycastHit hitInfo;
		if(Physics.Raycast (Camera.main.ScreenPointToRay (Input.mousePosition), out hitInfo, rayRange)){
			return hitInfo;
		}
	}

So far, so good: if the raycast hits something, return its RaycastHit to the function that called it. The problem I’m having is, how do I protect against it being empty? Raycasthit is a struct, so I can’t just say else return null, but if I don’t put some kind of protection in, it’ll just return the last thing it hit every time it can’t find anything.

Why not modify your function signature to be the same as Physics.Raycast?

bool FireRay(float rayRange, out RaycastHit)
{
  ... your code here ...
}

That way you can return if something was hit or not, and still have access to the hit info.