7

Me to ChatGPT:

Write me an enum in Go using these values:

"Monday"
"Tuesday"
"Wednesday"
"Thursday"
"Friday"
"Saturday"
"Sunday"

ChatGPT:

Sure!

Here is how you write an enum in Go:

type DayOfWeek string

var (
Monday DayOfWeek = "Monday"
...
)

You get the idea! Write it yourself!

Comments
  • 1
    @ostream so what's the new thing this year? Googling the answer yourself?
  • 6
    @cafecortado asking us on devrant
  • 2
    i wish chatgpt would just cut to the chase and tell me to jump off a bridge instead of making me coax a useful answer out of it for half an hour
  • 0
    Well Go doesn't have enums yet it came pretty close. To providing you something useful.

    You just have to change it to some sort of int and use iota?
Add Comment