Examples/Module: dplvar (example 2): Difference between revisions
< Examples
Content added Content deleted
imported>FrozenPlum (Created page with "<noinclude>{{noedit}}</noinclude><!-- This is the example preloaded for testing, press "Show Preview" to see the example working (at the bottom of the page). If you save this page, it saves as a new section at the bottom of your '''User:Username/Sandbox''' --> ==Example== This sets <pre> {{#dplvar:set|a|x|b|y|c|<!--empty-->}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|c|cccc}} {{#dplvar:default|d|dddd}} * a: {{#dplvar:a}} * b: {{#dplvar:b}} * c: {{#dplvar:c}} * d: {...") |
imported>FrozenPlum (Add example (that can be sandboxed on a users user page)) |
||
Line 5:
-->
==Example==
The first line's statements set the variables initially as: '''{{tt|a}}''' to <code>''x''</code>, '''{{tt|b}}''' to <code>''y''</code>, and '''{{tt|c}}''' to ''<code><nowiki><!--empty--></nowiki></code>''; then the following variables also have a default set: '''{{tt|a}}''' to <code>''aaaa''</code>, '''{{tt|c}}''' to <code>''cccc''</code>, and '''{{tt|d}}''' to <code>''dddd''</code>.
The last four lines display the value of each corresponding variable in a bulleted list format.
<pre>
{{#dplvar:set|a|x|b|y|c|<!--empty-->}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|c|cccc}} {{#dplvar:default|d|dddd}}
Line 22 ⟶ 25:
* c: {{#dplvar:c}}
* d: {{#dplvar:d}}
'''Notes:'''
* Variable "c" was set to "cccc" because although it was already set, its note is equivalent to an '''empty value'''.
* Variable "d" was set to "dddd" because it was '''not''' already set.
<noinclude>
[[Category:Uses dplvar module]]
|
Revision as of 00:23, 11 April 2023
Example
The first line's statements set the variables initially as: a to x
, b to y
, and c to <!--empty-->
; then the following variables also have a default set: a to aaaa
, c to cccc
, and d to dddd
.
The last four lines display the value of each corresponding variable in a bulleted list format.
{{#dplvar:set|a|x|b|y|c|<!--empty-->}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|c|cccc}} {{#dplvar:default|d|dddd}} * a: {{#dplvar:a}} * b: {{#dplvar:b}} * c: {{#dplvar:c}} * d: {{#dplvar:d}}
Result
{{#dplvar:set|a|x|b|y|c|}} {{#dplvar:default|a|aaaa}} {{#dplvar:default|c|cccc}} {{#dplvar:default|d|dddd}}
- a: {{#dplvar:a}}
- b: {{#dplvar:b}}
- c: {{#dplvar:c}}
- d: {{#dplvar:d}}
Notes:
- Variable "c" was set to "cccc" because although it was already set, its note is equivalent to an empty value.
- Variable "d" was set to "dddd" because it was not already set.