Second Advantage of Procedures

When you call a procedure to perform a task than writing the code "inline," it makes that code easier to read and maintain. Increasing the readability, and therefore the maintainability, of your code is a good enough reason by itself to break a block of code out into its own procedure. Not including the comments and blank lines, the GetUserName function contains 19 lines of code. By taking these 19 lines and moving them to their own procedure, we reduced the code from which we moved it by 19 lines. Less Code + good procedure name = easier to read. If ever you're writing some code that is getting rather long, consider breaking one or more sections of it out into their own functions or sub procedures.