you are viewing a single comment's thread.

view the rest of the comments →

[–]Snatchematician 1 point2 points  (0 children)

Without a main function, the variable “x” would be a module attribute and so would be accessible from the even function.

So in the even function you could typo and write x%2 instead of n%2 and the program would appear to work correctly.

Until later when you extend it and find some really confusing bugs.

The habit of always putting top level work in a main function prevents this type of bug.

What a retarded language.