Why is it recommended to have empty line in the en

2019-01-12 21:49发布

Some code style tools recommend this and I remember seeing some unix command line tools warning about missing empty line.

What is the reasoning for having an extra empty line?

8条回答
forever°为你锁心
2楼-- · 2019-01-12 22:48

Apart from the fact that it is a nicer cursor position when you move to the end of a file in a text editor.

Having a newline at the end of the file provides a simple check that the file has not been truncated.

查看更多
萌系小妹纸
3楼-- · 2019-01-12 22:50

It's because of the definition of what a text file is. When you create a new text file in any unix environment, the contents of that file is the new line character '\n'

Without this, the file isn't really identified as a text file. Now once we add code to this text file, its about not removing this initial new line that defines a text file itself.

查看更多
登录 后发表回答