yarn add --dev \
@babel/core \
@babel/cli \
@babel/preset-env \
@babel/preset-typescript \
typescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
// fibonacci 函数会返回一个返回 int 的函数。 | |
func fibonacci() func() int { | |
n0 := 0 | |
n1 := 1 | |
return func() int { | |
n2 := n0 + n1 |