Skip to content

Iota doesn't introduce an error message if used inside var declaration #1662

@nsf

Description

@nsf
package main

import "fmt"

var (
    a = iota
    b = iota
    c = iota
)

func main() {
    fmt.Println(a, b, c)
}

// Go compiler version: b84e614e2516 weekly/weekly.2011-03-28
// Compiler successfully compiles this code and the resulting binary prints:
// 0 0 0
// 
// Is it a bug? or an undocumented compiler extension?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions