Functions should return only meaningful values and should not display output of their own accord (unless that is the sole purpose of the function). If you encounter a circumstance under which you cannot return a value, and this circumstance is one that is likely to occur, you should return a value that indicates this condition.

Under exceptional circumstances, you may throw an exception; however, it is better to always return a value. Exceptions are inefficient and bad for code readability.