github.com/ks888/tgo@v0.0.0-20190130135156-80bf89407292/_examples/simple.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/ks888/tgo/lib/tracer"
     7  )
     8  
     9  func fib(n int) int {
    10  	if n == 0 || n == 1 {
    11  		return n
    12  	}
    13  	return fib(n-1) + fib(n-2)
    14  }
    15  
    16  func main() {
    17  	tracer.Start()
    18  
    19  	val := fib(3)
    20  	fmt.Println(val)
    21  
    22  	tracer.Stop()
    23  }