Jul-21-2017, 08:42 PM
(Jul-21-2017, 07:08 PM)nilamo Wrote: Most programs are written so that they're actually libraries. A "main" function is an entry point if you try to run the program directly, which then calls the libraries functions.
Structuring it this way makes it easy to do a lot of things, such as share your code with someone else (they can just "import" your code and call some functions, without your program starting to do it's things), or for testing.
If the "main" function is being called more than once, it's normally a red flag that something's a little fishy with the code.
Thanks!