Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Another important field of application is to outsource repeating parts of a program. Just imagine a script where you have to open a file for reading and writing at different positions of your script. Instead of adding the code for opening the file again and again, it is much more efficient to pack everything into a function and call it on demand. With a return() statement at the end of the function you can directly jump back to the last position. Similar to a function's argument, the return statement's brackets can also contain variables you want to hand over to the calling section of the script, but you can also introduce global variables instead.

...

Code Block
themeEclipse
languagepython
linenumberstrue
def main():
    execute your code here

if __name__ == "RealFlow":
    main()