View the Most Wanted LQ Wiki articles.
LinuxQuestions.org > Linux Wiki > Whitespace

From LQWiki

Jump to: navigation, search

Whitespace or "white space" refers to any number of spaces, tabs, or newlines placed between tokens, arguments, or words to separate them. In general, any amount of whitespace, even blank lines, is identical to a single space and is used to improve program readability.

The C programming language includes vertical tabs, formfeeds, and comments in the definition of whitespace. Newlines don't matter except in preprocessor directives. Some languages (especially shells like bash and tcsh) distinguish newlines as being different from spaces. Shells also sometimes require whitespace between symbols and other words, and sometimes don't. In LaTeX, most whitespace is the same as a space, except that a space after a macro often gets ignored, and a blank line separates paragraphs. PHP uses indentation at the beginning of a line to achieve compound statements.

Knowing how the language or shell being used treats whitespace can help make code more readable and hence less prone to bugs.

Finally, there is, of course, a programming language completely written in whitespace:


Personal tools