Template:Null/doc


 * Description
 * This template is used as a Null Variable or Null Template. Under normal usage it should return nothing.


 * Syntax
 * Type &#123;&#123;null&#125;&#125; somewhere, with parameters as shown below.


 * Sample output

Usage
While &#123;&#123;null&#125;&#125; does nothing, it is not useless and helps in formatting and readability. Its primary use is where a Variable/Template is needed but not the error output of an undefined template.

&#123;&#123;null&#125;&#125; Does support, but ignores any values sent to it when used as a template i.e. &#123;&#123;null|&#125;&#125;

When using null as a local variable, it does not support passing values, and requires a null value to work properly i.e. &#123;&#123;&#123;null|&#125;&#125;&#125;

EOL squashing
To remove End-of-line charterers (return/enter) that help the formatting of the code but must not show up in the output
 * As a template:

Code Line1&#123;&#123;null &#125;&#125;Line2

Returns Line1Line2


 * As a Variable,:

Code Line1&#123;&#123;&#123;null |&#125;&#125;&#125;Line2

Returns Line1Line2

The pipe '|' must be on the lower line, if its not you get a single white space character. Code Line1&#123;&#123;&#123;null| &#125;&#125;&#125;Line2

Returns Line1 Line2

If the pipe '|' can't be on the lower line, a dual pipe "||" on the upper line will work. Code Line1&#123;&#123;&#123;null|| &#125;&#125;&#125;Line2

Returns Line1Line2

Why use it?
This template allows the use of a blank template that doesn't error like a nonexistent template.

Normal output (Template): Code &#123;&#123;nonexistent-template&#125;&#125;

Returns

Normal output (Variable): Code &#123;&#123;&#123;nonexistent-variable&#125;&#125;&#125;

Returns

Technical Note
For the local Variable &#123;&#123;&#123;null|&#125;&#125;&#125; this template does nothing, and its really a comparison of the text string "null" and "", which gives us "". While the first text could be anything, this notation makes the code's intent, understandable. Do to the similarity with this template its easy to assume its just part of the normal operation of this template.

Examples: * 12345&#123;&#123;null&#125;&#125;6789 -> 123456789 * ABCD&#123;&#123;null|Coolness=Extreme&#125;&#125;EFGH -> ABCDEFGH * abc&#123;&#123;&#123;null|&#125;&#125;&#125;def -> abcdef