Friday, 13 September 2013

should function be defined before it is used in python?

should function be defined before it is used in python?

should the functions be defined before it is used? but why the following
code works:
def main():
dog()
def dog():
print("This is a dog.")
if __name__ == '__main__':
main()
I mean the dog() is defined after it is called, how this works?

No comments:

Post a Comment