代码
package main
import (
"fmt"
"time"
)
func sing(){
fmt.Println("武大郎:妹妹你坐船头")
fmt.Println()
time.Sleep(time.Second)
fmt.Println("武大郎:哥哥在岸上走")
fmt.Println()
time.Sleep(time.Second)
fmt.Println("武大郎:恩恩爱爱纤绳荡悠悠")
fmt.Println()
time.Sleep(time.Second)
fmt.Println("武大郎:妹妹你坐船头")
fmt.Println()
time.Sleep(time.Second)
}
func main(){
go sing()
fmt.Println("潘金莲:小妹妹我坐船头")
time.Sleep(time.Second)
fmt.Println("潘金莲:哥哥你在岸上走")
time.Sleep(time.Second)
fmt.Println("潘金莲:我俩的情我俩的爱")
time.Sleep(time.Second)
fmt.Println("潘金莲:在纤绳上荡悠悠荡悠悠")
time.Sleep(time.Second)
fmt.Println("潘金莲:你一步一叩首啊")
time.Sleep(time.Second)
fmt.Println("潘金莲:没有别的乞求")
time.Sleep(time.Second)
fmt.Println("潘金莲:只盼拉住我妹妹的手哇")
time.Sleep(time.Second)
fmt.Println("潘金莲:跟你并肩走")
time.Sleep(time.Second)
}
运行效果
潘金莲:小妹妹我坐船头
武大郎:妹妹你坐船头
武大郎:哥哥在岸上走
潘金莲:哥哥你在岸上走
武大郎:恩恩爱爱纤绳荡悠悠
潘金莲:我俩的情我俩的爱
潘金莲:在纤绳上荡悠悠荡悠悠
武大郎:妹妹你坐船头
潘金莲:你一步一叩首啊
潘金莲:没有别的乞求
潘金莲:只盼拉住我妹妹的手哇
潘金莲:跟你并肩走