package main
import "fmt"
func main() {
for i := 250; i <= 255; i++ {
fmt.Println("i=", i)
}
for j := uint8(250); j > 0; j++ {
fmt.Println("j=", j)
}
/* this will cause infinite loop
for k := uint8(250); k<=255; k++ {
fmt.Println("k=", k)
}
*/
}
All these three paragraph are trying to do the same thing.
In the 'k' sample, I must re-write my code as 'j' otherwise it will caused
infinite loop.
I'm wonder if there any 'lint option' could check this? Or, just treat it
as compiler error?
https://play.golang.org/p/61neJbuQ1U
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.