3 ms·
I don't program C or Go. I ran the logic and it works; I verified by running a modified version of this method on my computer. func below(n int) {
by all2 4y ago
I don't program C or Go. I ran the logic and it works; I verified by running a modified version of this method on my computer.
func below(n int) {
for n--; n >= 0; n-- {
fmt.Println(n)
}
}
I modified the type so I could punch in some sane integer, like 4. And this works.
C:\git\bugfix66> go run .\bugfix66-2.go
3
2
1
0
Am I to assume that the bug is actually a type issue? Something to do with unsigned integers?
Wait. Oh. Ok. I get it. It does have to do with the type signature.
- dekhn 4y agoWhat happens if you start at n=0 for uint64? (my real comment after I get some clarification from the bugfix site author is that I never, ever modify a variable in the initialization condition of a for loop, and i see that in the wild, I elide it.
- bugfix-66 4y agoYou're using a signed integer.