Difference between revisions of "Template:CodeSample"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>StDoodle
m (Protected "Template:CodeSample": High traffic page ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
(No difference)

Revision as of 06:22, 14 March 2010


Uses the named parameters title, description and code to display a code block & its information.

Note that only code is required; the title and description are optional.

A sample call to this template:

{{CodeSample|
title=Sample Code|
description=Some basic sample code.|
code=
<syntaxhighlight>
int i = 1; //this line is useless!
if (to_int(my_id()) > 1) {
   print("Aw, I guess you aren't Jick.");
}
</syntaxhighlight>
}}

Which produces the following:

Sample Code

Some basic sample code.

int i = 1; //this line is useless!
if (to_int(my_id()) > 1) {
   print("Aw, I guess you aren't Jick.");
}