×
Create a new article
Write your page title here:
We currently have 22 articles on The Grand Library of Hylia. Type your article name above or click on one of the titles below and start writing!



The Grand Library of Hylia
Revision as of 15:54, 9 December 2023 by ZoeySaurusRawr (talk | contribs) (Created page with "<noinclude>{{High Use}} ==Usage== This template is blank. It is used to represent a value being empty on other templates. To use this template, type: '''<nowiki>{{Void}}</nowiki>''' ==Importance== This template is critical for the proper functioning various parser functions. Specifically switch cases. Normally the #switch function cannot properly distinguish a null value from the default value. This template works around that. ::When using this: <b><nowiki>{{#switch:{{...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
size=40x40px This template is used on over 2500 pages. Take extra care when making changes, testing them in a sandbox first. If changes to this template require changes to pages that use it, you are responsible for making those changes.

Usage

This template is blank. It is used to represent a value being empty on other templates.

To use this template, type: {{Void}}

Importance

This template is critical for the proper functioning various parser functions. Specifically switch cases. Normally the #switch function cannot properly distinguish a null value from the default value. This template works around that.

When using this: {{#switch:{{{1|}}}|{{Void}}={{Void}}|Yes}}, it will always work.
When using this: {{#switch:{{{1|}}}| |Yes}}, it won't work because the function will think that both the blank space and the "yes" are what the default value is. And the "yes" overrides the blank space.

Here are some examples of this issue:

Using the void template:
Using a blank space:
Yes

In some cases however, there are other ways to work around this problem. Even in the above example. However these workarounds are less intuitive and make the coding more difficult to read and understand. Above you could replace the blank space with a single equals sign and it will work correctly. However, as stated before, this can be problematic with complex code. In cumbersome templates with lengthy switch cases this singular blank case with the equals sign can be potentially confusing and subjected to accidental removal in edits. It works as shown:

  • {{#switch:{{{1|}}}|=Blank|Not Blank}}
    • Blank

The code {{ns:0}} also behaves like void. But is also counter-intuitive and can make template coding potentially confusing.
So all in all this template exists for readability and convienience of the codes in the edit view. It's largely harmless to keep.