Welcome to Nim Book

Search:

This is a test project for nim book.

Code

Inline code snippet:

proc twice*(a: int): int =
  a * 2

This snippet is tested during documentation build:

proc twice*(a: int): int =
  a * 2

assert 10.twice == 20

The same but using .. code:: directive:

proc twice*(a: int): int =
  a * 2
proc twice*(a: int): int =
  a * 2

assert 10.twice == 20

Code included from a source file:

proc double*(x: int): int =
  x * 2

Selective inclusuion:

proc double*(x: int): int =
  x * 2

Doesn't have to be Nim code:

# This is Python
def double(x: int) -> int:
    return x * 2

Admonitions

Note: General info
Warning:

It's dangerous to go alone!

Take this!

Error: Oh, snap :-(
Important: Admonitions can contain lists and code blocks.
  • This
  • is
  • great!
echo "Indeed"

Links

This is a link to a heading on the same page: Code.

This is a link to a heading on another page: intro.md: Heading.

Same, but with different syntax: intro.md: Heading.

You can use standard Markdown syntax, too: I am a link