Template:Bcode:Syntax

From Wikibooks, open books for an open world
Jump to navigation Jump to 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 particularly useful for presentation of code segments that lack formatting via the <code>...</code> tags, e.g. TI-BASIC.

Usage[edit source]

  • Call with {{[[Template:Bcode:name|Bcode:name]]}} followed by the arguments separated with the pipe | character
  • No <pre>...</pre> tags needed
  • Italicize variables or place them within <var>...</var> tags

Available Templates[edit source]

There are three formatting styles:

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

Syntax[edit source]

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:

{{Bcode:Syntax|
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 parser renders the above to appear as:

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