Not all code paths return a value {c#}

hello, im new to C# so i was following an endless runner tutorial on youtube(almost exactly) and i came into this error that did not seem to occur in the tutorial. here is the link to the tutorial if anyone needs Unity Endless Runner Tutorial #6 Object Pooling - YouTube

public GameObject GetPooledObject() {

	for (int i = 0; i < pooledObjects.Count; i++) 
	{

		if (!pooledObjects*.activeInHierarchy)* 
  •   	{*
    

_ return pooledObjects*;_
_
}_
_
GameObject obj = (GameObject)Instantiate (pooledObject);_
_
obj.SetActive (false);_
_
pooledObjects.Add (obj);_
_
return (obj);_
_
}_
_
}_
_
}*_

The compiler do not know what to return if pooledObjets.Count == 0. Just add a return null; in the end.

    public GameObject GetPooledObject()
    {
        for (int i = 0; i < pooledObjects.Count; i++)
        {
            if (!pooledObjects*.activeInHierarchy)*

{
return pooledObjects*;*
}
GameObject obj = (GameObject)Instantiate(pooledObject);
obj.SetActive(false);
pooledObjects.Add(obj);
return (obj);
}
return null;
}