You are confusing the Return VALUE with the Return CODE. The Return CODE is the error status and 0=Success, non-0=failure. The VALUE is the data returned. Some functions don't return any "data" so they (if well-written) will return the opposite of the CODE. Reread my example above. Without a return VALUE, I would need to examine the Return CODE every time to determine if the function was successful. By returning an inverted VALUE, I can simply test whether the the VALUE is true without checking the CODE. Thus, the code is checked only IF there's a failure and we need to determine what that failure was and if we can recover.
The Return VALUE can be any non-zero or non-null value to indicate success. Apps often return -1, scripts often return 1. Same result.
_________________________
Actually I
am a Rocket Scientist!