Help us understand the problem. What is going on with this article?

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

More than 1 year has passed since last update.

例えば開始番号を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
}
DQNEO
PHP/Go/Perl/C/Docker/Linux/Git/AWS
http://dqn.sakusakutto.jp
mercari
フリマアプリ「メルカリ」を、グローバルで開発しています。
https://tech.mercari.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away