06
 

Code

In a normal line, if you want to format text as code, wrap it with backtick quotes (`).

Code blocks are produced by indenting every line of the block by at least 4 spaces or 1 tab.

Click on the red points to know more. Move through the exercises by using the buttons or the dot menu at the bottom.

Click on the red points to know more. Move through the exercises by using the buttons or by swiping left or right.

Inline `code`  This is a code block (each line is idented by at least 4 spaces or 1 tab)
  • More

    To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:
    ``A literal backtick (`).``

    Close
  • More

    Remember, one level of indentation in a code block equals 4 spaces or 1 tab.

    Close
  • More

    A code block continues until it reaches a line that is not indented.

    Close

Format the text "c=a+++++b;" as inline code.

Show generated HTML?

Format the last three lines as a code block.

Show generated HTML?

Play with the concepts you just learned!

For example:
Create a code block with many levels of indentation
Can you format text (like bold and italics) inside a code block?

See the generated HTML. Even if you don't know HTML, try to understand what's happening. Go wild!
Go to the next lesson when you're ready.

Show generated HTML?

Go to the next lesson