📌  相关文章
📜  golang switch no condition - Go 编程语言 - Go 编程语言代码示例

📅  最后修改于: 2022-03-11 14:45:02.458000             🧑  作者: Mango

代码示例1
package main

import (
    "fmt"
    "time"
)

func main() {
    t := time.Now()
    switch {
    case t.Hour() < 12:
        fmt.Println("Good morning!")
    case t.Hour() < 17:
        fmt.Println("Good afternoon.")
    default:
        fmt.Println("Good evening.")
    }
}