I'm helping in a project of my course in the college and we have a script that depends on the return value of the main function of one of its modules (by main function, I mean the main()). But in that function, no value is returned: either the code has done successfully what it was supposed to do, or not.
So, if there's no return statement in the function, what's the standard value to be returned if it reaches the end of the function?
You've already made a false assumption from the start, which is that there is necessarily a main function at all. There isn't: Python doesn't need one, and doesn't call one automatically if it's there. Rather, all Python modules are executed from top to bottom; if the only thing at module level is a call to main(), then that is what is called, but otherwise it will not happen.
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