9951 explained code solutions for 126 technologies


golangHow to start iota values from 1


package main
import "fmt"

const (
  _ int = iota
  Joe
  Donald
)

func main() {
  fmt.Println(Joe)
  fmt.Println(Donald)
}ctrl + c
package main

default package declaration

import "fmt"

loads fmt package to operate on strings (and print them)

const (

defines constants

int = iota

assign int value to given constant and auto incremented value starting from 0

Joe

first constant with value 1 (because first 0 value is skipped)

_

skips single item in values generated by iota