Template:Bcode:Example

From Wikibooks, open books for an open world
Jump to: navigation, search

The bcode templates are designed to be included into pages as templates for specific formatting of code. Bcode is merely a shortening of Basic Code (though no relation to BASIC or Visual Basic) which represents the fact that these are very simple formats. They're paticularly useful for presentation of code segments that lack formatting via the <code>...</code> tags, e.g. TI-BASIC.

Use as follows:

  • Call with bcode:name followed by the arguments, all within two brackets (as a standard template)
  • No pre tags are needed.
  • Italicize variables.

Available Templates[edit]

There are three formatting styles.

  • Syntax - The syntax of a programming language function (or any other applicable use)
  • Example - An example of a programming language function (or any other applicable use)
  • Output - What the output of a program would look like if run

Syntax[edit]

The first argument is the syntax of a programming language function (or any other applicable use) and the second argument is limitations to the code:

printMessage(msg)

*Where msg is a message to output to the user, and msg must

  • be less than 255 characters in length
  • end with the '@' character

The code for the above follows:

{{bcode:Example|
printMessage(''msg'')
|
Where ''msg'' is a message to output to the user, and ''msg'' must
*be less than 255 characters in length
*end with the '@' character
}}