I made a file named "Main" in pydev and inside it wrote:
if __name__ =='__Main__':
main()
def main():
print("jargon")
It says my call to main() under the if statement contains an undefined variable and won't compile. Why does it do this?
Python code is executed top-to-bottom. You need to move your main() definition above the if __name__ == '__main__' block. The way you have it, at the time that you try to call main(), the function does not yet exist.
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