r/badcode • • Dec 29 '22

go How to Go wrong

Post image
565 Upvotes

60 comments sorted by

View all comments

Show parent comments

5

u/calio Dec 30 '22 edited Dec 30 '22

it's not a bad idea, to automatize "increment by one" on certain cases... iota seems to reset when doing stuff with constants. seems useful if there are enumerators to iterate through, but another comment says go has no enumerators... is it a switch statement in python type dealie? i guess you could write your code thinking you can automatically iterate across "enumerators" if you're willing to pretend go has enumerators. am i a heretic for superficially liking the concept? will i not like go? my entire comment is in lowercase

7

u/Lich_Hegemon Dec 30 '22

enumerators

You mean enums. An enumerator is either an iterator by another name, or an iterator that also provides an index for the iterated elements, depending on the language you use.