Template:Out: Difference between revisions

From Rosetta Code
Content added Content deleted
(add two optional parameters "in" and "comment", and properly document the template)
m (typo)
Line 2: Line 2:
;{{#if: {{{1|}}} | {{{1}}} | Output}}{{#if: {{{comment|}}}{{{in|}}} | <span style="font-weight:normal> &nbsp; &mdash;&nbsp; {{#if: {{{comment|}}} | {{{comment|}}} | when given an input of <code>{{{in|}}}</code>}}</span> |}}<nowiki>:</nowiki></div></includeonly><noinclude>
;{{#if: {{{1|}}} | {{{1}}} | Output}}{{#if: {{{comment|}}}{{{in|}}} | <span style="font-weight:normal> &nbsp; &mdash;&nbsp; {{#if: {{{comment|}}} | {{{comment|}}} | when given an input of <code>{{{in|}}}</code>}}</span> |}}<nowiki>:</nowiki></div></includeonly><noinclude>


This template is used to introduce the example output of a programming example.
This template is used to introduce the output of a programming example.


===Usage===
===Usage===

Revision as of 07:19, 25 August 2016


This template is used to introduce the output of a programming example.

Usage

Write {{out}} just above the <pre>...</pre> block that lists a code example's output.

It also accepts these optional parameters:

Parameter Purpose Example Renders as
{{out}}
Output:
1 Replaces the word "Output". {{out|Return value}}
Return value:
in The (single-line) input which produces this output. {{out|in=Hello world}}
Output   —  when given an input of Hello world:
comment Any other text you want shown in the same line. {{out|comment=test case 1}}}}
Output   —  test case 1:

This is a template. There are many others. See Category:RCTemplates for a complete list of templates.