Block code

The block code directive will add <pre> and <code> tags.

Textile example: Block code

bc. 10 PRINT "I ROCK AT BASIC!"
20 GOTO 10

Textile input (editable)

Browser output

HTML output


More about: Block code

1. For long blocks of code with blank lines in between, use the extended block directive bc.. and end the block with p. or with another block tag:

bc.. REM QuickBASIC example
INPUT "What is your name: ", UserName$
PRINT "Hello "; UserName$

DO
  INPUT "How many stars do you want: ", NumStars
  Stars$ = STRING$(NumStars, "*")
  PRINT Stars$

  DO
    INPUT "Do you want more stars? ", Answer$
  LOOP UNTIL Answer$ <> ""

  Answer$ = LEFT$(Answer$, 1)
LOOP WHILE UCASE$(Answer$) = "Y"

PRINT "Goodbye "; UserName$

2. For inline snippets of code: Wrap with the at @ character:

A line with @code@.

3. NOTE: The pre. tag is similar to the bc. tag, but no <code> ... </code> tags are used within a <pre> block.

Further reading: Block code

  1. MDN: The HTML <code> element

See something wrong in this page? Outdated info, a broken link, faulty code example, or whatever? Please write an issue and we’ll fix it.