📖 INDEX
LOADING ENGINE...
__name__ == '__main__'
PYTHON REFERENCE // name-main
Allows code to run when file is run as script, but not when imported
Syntax
if __name__ == '__main__':
main()Examples
Example 01Basic Usage
if __name__ == '__main__':
main()Best Practices
- Consult official Python documentation for advanced usage.
- Ensure proper indentation and Pythonic style (PEP 8).