Function returing either boolean or string value
I have a requirement where I want function to return either error message in case of failure or true if success. I have done this but the problem is when I compare the returned value of true I have o use "TRUE" in stead of just TRUE. There is another way like return empty string like "" if there is no error. But is this the best way of implementing error or no error from the function?
Example - I would like to check if the user is valid user if yes then return true or else return error message. By returning error message from function, I would like to track all error messages in my one common script.