So returning 0 in a function (Not main) means false and returning 1 or anything but 0 means success.
Why in the main() function do we put 0, meaning there were no errors when 1 in other functions mean it ran successfully, thanks.
return 0: A return 0 means that the program will execute successfully and did what it was intended to do. return 1: A return 1 means that there is some error while executing the program, and it is not performing what it was intended to do.
in main function return 0 or exit(0) are same but if you write exit(0) in different function then you program will exit from that position. returning different values like return 1 or return -1 means that program is returning error .
Your method has no return type, Provide a return type of int in your method. And return -1 means nothing in java, you are just returning a int value, thats it.
Answer. You had no tax liability for the prior year if your total tax was zero or you didn't have to file an income tax return. Your total tax was zero if the line labeled "total tax" on Form 1040, U.S. Individual Income Tax Return or Form 1040-SR, U.S Tax Return for Seniors was zero.
0
and 1
(or any non-zero number) convert to the boolean values false
and true
in a context where a conversion to bool
happens, e.g. in if(
here
) ...
. This is used within your program.
The return value from main
is used in a different way, it is returned to the shell that called the program. In the shell's context the value is interpreted differently. There, 0
traditionally means "no error" while values larger than zero indicate errors and the value itself contains some hints as to what kind of error occurred. Take this snippet from man grep
:
EXIT STATUS
The grep utility exits with one of the following values:
0 One or more lines were selected.
1 No lines were selected.
>1 An error occurred.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With