Go

What will be the output of the following block of code?:

package main

import "fmt"

const (
	_ = iota + 3
	x
)

func main() {
	fmt.Printf("%v\n", x)
}

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

Since the first iota is declared with the value 3 ( + 3), the next one has the value 4