Posts: 73
Joined: Aug 2016
Reputation:
0
2017-01-21, 14:44
(This post was last modified: 2017-01-21, 14:44 by M-Reimer.)
I've seen the line in the subject in some Addons so I just added it to mine, too.
But why do I need it? What is it meant to do? Can I just drop this "if block"?
Posts: 1,665
Joined: Jun 2011
Reputation:
119
This condition usually protects module-level executable instructions and prevents side-effects when your script is imported from another script. Even if this is the main script, it may be imported, for example, from a testing suite. So it's a good habit to use this condition even though it's not strictly necessary.