4 ms·
const ( Break BreakOrContinue = iota Continue BreakOrContinue = iota ) This is not how `iota` works...
by kiitos 3y ago
const (
Break BreakOrContinue = iota
Continue BreakOrContinue = iota
)
This is not how `iota` works...
- lifthrasiir 3y agoAmazingly enough, it is (try it yourself!). This predefined identifier changes its value for every constant declaration [1], and the declaration itself just fills the expression list from the previous when missing. [1] https://go.dev/ref/spec#Iota https://go.dev/ref/spec#Iota
- deleted 3y ago[deleted]
- foldr 3y agoHmm, as the sister comment points out, this sets Break and Continue to different values, which is all that’s required. Maybe there is a more stylish way of accomplishing the same thing that I’m unaware of, but it’s not a bug. This is a nice example of the bizarre negativity you tend to get when posting any project on an Internet forum. I don’t expect anyone to be even remotely impressed by my implementation of a completely standard binary heap. But it’s amusing that the one comment that this has attracted is a piece of snark that appears not even to be technically correct.