Whitespace
From DocForge
| Line 1: | Line 1: | ||
| - | '''Whitespace''' is the emptiness | + | '''Whitespace''' is the visual emptiness in [[string]]s, usually implemented with [[newline]], [[tab]] and [[space]] [[character]]s. While documents are typically printed or written on white paper, leaving white space between characters, computer displays and other electronics may render the background as any color. |
| - | In [[free-form programming language]]s, whitespace characters are ignored by [[compiler]]s and | + | == Characters == |
| + | {| | ||
| + | |- | ||
| + | ! Character | ||
| + | ! [[ASCII]] Decimal Value | ||
| + | ! Escape | ||
| + | |- | ||
| + | | Space | ||
| + | | 32 | ||
| + | | | ||
| + | |- | ||
| + | | Tab | ||
| + | | 9 | ||
| + | | \t | ||
| + | |- | ||
| + | | Newline | ||
| + | | 10 | ||
| + | | \n | ||
| + | |- | ||
| + | | Carriage Return | ||
| + | | 13 | ||
| + | | \r | ||
| + | |} | ||
| + | |||
| + | |||
| + | == Source Code == | ||
| + | In [[free-form programming language]]s, whitespace characters in [[source code]] are ignored by [[compiler]]s and [[interpreter]]s, serving only to help organize source code and separate [[token]]s. For example, tab or space characters can show a hierarchical relationship between lines by indenting them by different amounts, such as nested loops. Therefore proper use of whitespace is an important part of good [[coding standards]]. | ||
In non-free-form programming languages, such as [[Python]], whitespace characters are used to determine blocks of code by the compiler. The code of a function or a loop is indented further with whitespace and not delimited with keywords or other characters. | In non-free-form programming languages, such as [[Python]], whitespace characters are used to determine blocks of code by the compiler. The code of a function or a loop is indented further with whitespace and not delimited with keywords or other characters. | ||
Current revision as of 18:54, 15 March 2010
Whitespace is the visual emptiness in strings, usually implemented with newline, tab and space characters. While documents are typically printed or written on white paper, leaving white space between characters, computer displays and other electronics may render the background as any color.
Characters [edit]
| Character | ASCII Decimal Value | Escape |
|---|---|---|
| Space | 32 | |
| Tab | 9 | \t |
| Newline | 10 | \n |
| Carriage Return | 13 | \r |
Source Code [edit]
In free-form programming languages, whitespace characters in source code are ignored by compilers and interpreters, serving only to help organize source code and separate tokens. For example, tab or space characters can show a hierarchical relationship between lines by indenting them by different amounts, such as nested loops. Therefore proper use of whitespace is an important part of good coding standards.
In non-free-form programming languages, such as Python, whitespace characters are used to determine blocks of code by the compiler. The code of a function or a loop is indented further with whitespace and not delimited with keywords or other characters.

