It's nice if there are empty lines marking the separation between any two blocks of logically and significantly distinct chunks of code, and for aesthetics.  (Code that's pretty is code that's easy to read, and writing readable code is one of the absolutely most important aspects of writing good, maintainable software—no exaggeration.)