3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Golangで iotaの開始番号を指定する

Posted at

例えば開始番号を10にしたい場合、このように書けばOKです。

const (
    FOO = iota + 10
    BAR
    BUZ
)

package main

import "fmt"

const (
    FOO = iota + 10
    BAR
    BUZ
)
func main(){
    fmt.Printf("%v\n", FOO) // => 10
    fmt.Printf("%v\n", BAR) // => 11
    fmt.Printf("%v\n", BUZ) // => 12
    return
}
3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?