生命之诗-go

package main

import (
    "fmt"
    "math/rand"
    "time"
)

func random(n int)(int){
    rand.Seed(time.Now().UnixNano())
    return rand.Intn(n)
}

func doPlan(){
    plans := [3]string{
        "Failed, try again",
        "Fell down, come one",
        "Congratulations, keep going"}

    fmt.Println("I got new plan")
    Loop:
        index := random(3);
        fmt.Println(plans[index])
        if index == 0 {
            goto Loop
        }
}

func life(){
    doPlan()
    if random(2) == 0{
        fmt.Println("No regrets");
        return
    }
    life()
}

func main() {
    life()
}
;生命是一段漫长的旅程
;想了,就去做
;输了,重头再来
;摔了,爬起来继续
;赢了,还要再往前走
;死了,没留下任何遗憾