Constants

const first = "first"

const (
    one = iota // 0
    two        // 1
    three      // 2
)

const fourth = iota // 0

const (
    B = 1 << (10 * iota) // 1: 2^0
    KB                   // 1024: 2^10
    MB                   // 10485676: 2^100
)

Getting the pointer of constant or literal is illegal.

Constants can take any primitive data.

results matching ""

    No results matching ""