What is a rune?

后端 未结 7 1473
予麋鹿
予麋鹿 2020-12-12 09:15

What is a rune in Go?

I\'ve been googling but Golang only says in one line: rune is an alias for int32.

But h

相关标签:
7条回答
  • Everyone else has covered the part related to runes, so I am not going to talk about that.

    However, there is also a question related to switch not having any arguments. This is simply because in Golang, switch without an expression is an alternate way to express if/else logic. For example, writing this:

    t := time.Now()
    switch {
    case t.Hour() < 12:
        fmt.Println("It's before noon")
    default:
        fmt.Println("It's after noon")
    }
    

    is same as writing this:

    t := time.Now()
    if t.Hour() < 12 {
        fmt.Println("It's before noon")
    } else {
        fmt.Println("It's after noon")
    }
    

    You can read more here.

    0 讨论(0)
提交回复
热议问题