fibonacci

command
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 0 Imported by: 0

README

fibonacci

An example of how to use mdcode

In this example, the examples consist of 4 code blocks each. Of course, any markdown text can be included between individual code blocks. The code block describing the outline of the source file is an invisible code block, just like the test code required for testing.

If you look at the source of this document, you can see how the embedding is done.

JavaScript

function fibonacci(n) {
    if (n < 1) {
        return 0
    }
    if (n == 1) {
        return 1
    }
    return fibonacci(n - 1) + fibonacci(n - 2)
}

go

func fibonacci(n uint64) uint64 {
	if n == 0 {
		return 0
	}
	if n == 1 {
		return 1
	}
	return fibonacci(n-1) + fibonacci(n-2)
}

Tasks

To try mdcode here are some easy tasks

extract

You can extract the example code and the test code using the following command:

mdcode extract
test

After extractiong, you can run the test using the following commands:

go test
node --test
update

After modifying the files, you can update the code blocks in the document using the following command:

mdcode update

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL