I want a function to return a certain value, else return false
<p>In short, I notice that a lot of predefined functions in Unity (A simple game development platform I use) will either return a value (Such as a coordinate), or will return false if certain conditions are met. I attempted to do this myself, however the compiler is always looking for a transform as a return type, and will not allow me to return a boolean (because the function is declared to return a transform).</p>

<pre><code>    Transform SelectObject() {
    RaycastHit hit;
    Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
    if (Physics.Raycast (ray, out hit, unitLayer))
        return hit.transform;
    else
        return false;
}
</code></pre>

<p>How do I return a certain data type, but also have my function return boolean (false) when the function 'fails' its task?</p>