Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python if main

# if __name__ == '__main__' checks if a file is imported as a module or not.
# example: 
def main():
    print('Hello World')
    
if __name__ == '__main__':
    # This code won't run if this file is imported.
    main()
 
PREVIOUS NEXT
Tagged: #python #main
ADD COMMENT
Topic
Name
7+4 =