Main Block

One more bit of housekeeping before we get into writing our game. Let’s make a “main block” for the startup of our program.

Code

import arcade

if __name__ == '__main__':
    print(arcade.RELEASE)

Analysis

  • Difference between running a file and importing a file
  • How to tell the difference? The “main block”
  • Also nice: PyCharm’s gutter icon

Exercises

  1. Instead of code under the if, make a function main with the code, then call it from the main block.